You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Setting pythonPath with ${workspaceFolder} in launch.json configs doesn't work #12289
I happen to use a custom interpreter and I actually have a variety of workspace folders that draw their settings from a same template for my .vscode settings, so it would be great it we could get the variable to work...
I'm using Ubuntu 18.04, with latest vscode (1.46.0). For anyone trying to debug this: I guess it can be easily reproduced by symlinking your system's python into a folder under your workspaceFolder.
Environment data
VS Code version: 1.46.0
Extension version (available under the Extensions sidebar): 2020.5.86806
OS and version: Ubuntu 18.04
Python version (& distribution if applicable, e.g. Anaconda): 2.7.17 64-bit
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): custom
Relevant/affected Python packages and their versions: N/A
Relevant/affected Python-related VS Code extensions and their versions: N/A
koenlek This is to notify that we can confirm the bug, thanks. As a workaround, if you want to use the workspace pythonPath setting in launch.json, you can just use,
"pythonPath": "${command:python.interpreterPath}"
Please let me know if that works for you. If not, please paste the error logs you see on developer tools.
Kartik Raj (@karrtikr), unfortunately, that doesn't work. It gives an error "The Python path in your debug configuration is invalid" once I try to run it. I just feel like any variable expression (e.g. ${...}) under "pythonPath" doesn't work...
That's weird, can you please check the values supported for the property "pythonPath"?
You can do that in some new launch.json task, adding the property key and then trying to add a value. You should see which options are available
koenlek Can you update to the latest stable version of the extension? We use ${command:python.interpreterPath} in there. Also, does the workaround work?
You are right! I assume it changed in a recent release, because I committed the working config to git and after updating my vscode + extensions, the config was changed from "${config:python.interpreterPath}" to "${command:python.interpreterPath}"...
Do you want to close the issue? I still think it would be good to make variables like ${workspaceFolder} work better in launch.json for the python plugin...
Activity
karrtikr commentedon Jun 16, 2020
koenlek This is to notify that we can confirm the bug, thanks. As a workaround, if you want to use the workspace pythonPath setting in launch.json, you can just use,
Please let me know if that works for you. If not, please paste the error logs you see on developer tools.
koenlek commentedon Jun 17, 2020
Kartik Raj (@karrtikr), unfortunately, that doesn't work. It gives an error "The Python path in your debug configuration is invalid" once I try to run it. I just feel like any variable expression (e.g.
${...}) under"pythonPath"doesn't work...karrtikr commentedon Jun 17, 2020
That's weird, can you please check the values supported for the property "pythonPath"?
You can do that in some new launch.json task, adding the property key and then trying to add a value. You should see which options are available
koenlek commentedon Jun 17, 2020
Found it! There was a small typo in your suggestion.
karrtikr commentedon Jun 18, 2020
koenlek Can you update to the latest stable version of the extension? We use
${command:python.interpreterPath}in there. Also, does the workaround work?koenlek commentedon Jun 19, 2020
You are right! I assume it changed in a recent release, because I committed the working config to git and after updating my vscode + extensions, the config was changed from
"${config:python.interpreterPath}"to"${command:python.interpreterPath}"...This workaround works great for me, thanks!
koenlek commentedon Jun 19, 2020
Do you want to close the issue? I still think it would be good to make variables like
${workspaceFolder}work better in launch.json for the python plugin...karrtikr commentedon Jun 20, 2020
Yup let's leave it open. It's useful in cases where debugging interpreter is different than the one selected.
karrtikr commentedon Oct 22, 2021
Fixed with #17837