I am trying to learn Python and set up VS Code's Python debugger as this video describes: https://www.lynda.com/Python-tutorials/Choosing-editor-IDE/661773/707220-4.html
However the instructor seems to be on VS Code 1.18 and I'm on 1.28. I set up the launch.json configuration up to how it appears in the video but I'm getting a green line under "debugOptions" that says "Property debugOptions is not allowed". Anyone know how I can set up my environment so that it works the way the instructor is explaining. I'm on Windows 10.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"cwd": "",
"env":{},
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOuput"
]
},
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"port": 5678,
"host": "localhost"
},
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "enter-your-module-name-here",
"console": "integratedTerminal"
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"console": "integratedTerminal",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"django": true
},
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"jinja": true
},
{
"name": "Python: Current File (External Terminal)",
"type": "python",
"request": "launch",
"program": "",
"console": "externalTerminal"
}
]
}
To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D. The Run and Debug view displays all information related to running and debugging and has a top bar with debugging commands and configuration settings.
To end a debugging session in Microsoft Visual Studio, from the Debug menu, choose Stop Debugging.
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"cwd": "",
"env":{},
"envFile": "${workspaceRoot}/.env",
"console": "none" //add this and go
Instead of
"debugOptions": [
"RedirectOutput"
],
use
"redirectOutput": true,
etc. Check for proper configuration options (and whether you want them) at VSCode debugging documentation. I can't seem to find the first two options at the first glance though, consider whether you need it and google it if so.
The whole first config block for you would then be
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"cwd": "",
"env":{},
"envFile": "${workspaceRoot}/.env",
"redirectOutput": true,
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With