Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code: "Property Debug Options Not Allowed"

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"
    }
]

}

like image 283
AlternativeHacks Avatar asked Oct 14 '18 22:10

AlternativeHacks


People also ask

How do I enable Debug mode in Vscode?

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.

What is disable Debug mode in VS code?

To end a debugging session in Microsoft Visual Studio, from the Debug menu, choose Stop Debugging.


2 Answers

       "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
like image 142
Gustavo Chiclla Avatar answered Oct 04 '22 21:10

Gustavo Chiclla


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,
    },
like image 30
LuH Avatar answered Oct 04 '22 21:10

LuH