Why do I get a “Property pythonPath is not allowed” on my launch.json?

Viewed 2412

In my launch.json, although the property pythonPath works fine, the Intellisense marks it as "Property pythonPath is not allowed".

enter image description here

1 Answers

The debugging configuration for Python does not have a "pythonPath" setting, so that message is actually correct. When you say that it "works fine", what actually happens is that it's simply ignored by the debugger. That's why it's only shown in a yellow squiggly line, because it's just a warning for an unused/ignored setting, and it will not stop/block the debugger.

The correct setting is simply "python":

python

Full path that points to the Python interpreter to be used for debugging.

If not specified, this setting defaults to the interpreter identified in the python.pythonPath setting, which is equivalent to using the value ${config:python.pythonPath}. To use a different interpreter, specify its path instead in the python property of a debug configuration.

Alternately, you can use a custom environment variable that's defined on each platform to contain the full path to the Python interpreter to use, so that no additional folder paths are needed.

If you need to pass arguments to the Python interpreter, you can use the syntax "python": ["<path>", "<arg>",...].

Maybe it defaulted to a valid "python.pythonPath" setting on your environment, which made it look like that it's working.

Related