0

I can't seem to get my settings.json file to influence how python is invoked in VSCode when selecting "Run Code" (default hot key Ctrl + Alt + N), my user settings.json is as follows:

{
    "python.pythonPath": "/usr/bin/python3",
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "python.jediEnabled": true,
    "editor.minimap.enabled": true,
    "editor.multiCursorModifier": "ctrlCmd",
    "workbench.tree.indent": 24,
    "workbench.startupEditor": "untitled",
    "workbench.settings.editor": "json",
    "workbench.settings.openDefaultKeybindings": false,
    "workbench.settings.openDefaultSettings": true,
    "workbench.settings.useSplitJSON": false,   
    "explorer.confirmDragAndDrop": false,
    "python.linting.enabled": true,
    "python.languageServer": "Jedi",
}

yet when I run my python file, not debug it, it is showing:

[Running] python -u "path/to/file.py"

when I am expecting (as I set python.pythonPath in settings.json):

[Running] /usr/bin/python3 -u "path/to/file.py"

Why is my settings.json file key python.pythonPath having no effect on how my code is invoked?

Among other important reasons, my python code doesn't even run as python invokes python 2 on my machine when my code is written in python 3.

VSCode version:

Version: 1.47.3
Commit: 91899dcef7b8110878ea59626991a18c8a6a1b3e
Date: 2020-07-23T15:51:39.791Z (1 mo ago)
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 4.15.0-112-generic
0

1 Answer 1

2

From vscode-python-DeprecatePythonPath, python.pythonPath setting is being removed from all 3 scopes - User, workspace, workspace folder. The path to the workspace interpreter will now be stored in VS Code’s persistent storage instead of the settings.json file. That's why your setting has no effect on code execution path. You can change the value stored in workspace settings using Python: Select Interpreter command, or add the setting in User settings.json:

"python.defaultInterpreterPath":
Sign up to request clarification or add additional context in comments.

1 Comment

So it's only now stored in a persistent storage? Was that change perhaps motivated by an ill-conceived conviction that settings.json was not kept in a persistent location and users liked to manually restore all VS Code settings after each application restart?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.