0

I use VSC latest version (1.59) on mac/osx. When i modify some settings usually they should be recorded in the user setting. If i open my setting in json format , some lines will look like this :

"workbench.settings.editor": "json",
"workbench.colorTheme": "Monokai",
"workbench.iconTheme": "ayu",

That's the changes i made to the color theme and file icon. But when i change my python interpreter in the command palette -> python:select interpreter, the changes i made is not recorded/written there. I expect line like :

python.defaultInterpreterPath = .....

But i doesn't exist. It actually behaves properly and use the selected python interpreter as expected but it's just not being written to the user setting.json file inside my user directory (/Users/andi/Library/Application Support/Code/User/setting.json) or inside the .vscode folder in current project.

Does anyone know where this setting has been written to ?

andio
  • 1,574
  • 9
  • 26
  • 45

1 Answers1

0

It will modify the setting of python.pythonPath instead of python.defaultInterpreterPath in your Workspace setting.

The explanation of python.defaultInterpreterPath(official docs):

Path to the default Python interpreter to be used by the Python extension on the first time it loads for a workspace, or the path to a folder containing the Python interpreter. Can use variables like ${workspaceFolder} and ${workspaceFolder}/.venv. Using a path to a folder allows anyone working with a project to create an environment in the .venv folder as appropriate to their operating system, rather than having to specify an exact platform-dependent path. settings.json file can then be included in a source code repository. Note: Changes to this setting made after an interpreter has been selected for a workspace will not be applied or considered by the Python extension. As well, the Python extension doesn't automatically add or change this setting.

Update:

Sorry for that. For testing, I have used the Python Extension with an older version. python.pythonPath can not be changed in the new version.

python.defaultInterpreterPath only work for the first time, and will not be changed when you switch the python interpreter(official docs).

A new optional setting python.defaultInterpreterPath is introduced in the user and workspace scope, from which the extension will read the value when loading a project for the first time.

Changes to the python.defaultInterpreterPath will not be picked up by the Python extension once an interpreter is already selected for the workspace. The extension will also not set nor change the value of this setting, it will only read from it.

In fact, the python interpreter path will be stored in the local storage and you can not modify it.

Steven-MSFT
  • 7,438
  • 1
  • 5
  • 13
  • Yes, python.pythonPath is just the first thing i'm looking for. But it's just doesn't exist anywhere both in my user setting and workspace setting. I don't use venv. So normally it's suppose to be under .vscode folder in current workspace or in my user lib folder. – andio Aug 23 '21 at 18:30
  • And because the python.pythonPath doesn't exist and i got some warning said that the pythonPath is obsolete when trying to manually add it, so i then look for python.defaultInterpreterPath – andio Aug 24 '21 at 02:06
  • @andio thanks for your response, could have a look at the update of this answer? – Steven-MSFT Aug 24 '21 at 02:57
  • @andio Does this help? If you have any doubt about it, feel free to let me know. – Steven-MSFT Aug 24 '21 at 05:34