I want to use exactly the same vscode workspace folder on both Windows and Linux. As you may know, contrary to Pycharm, the root folder is unfortunately not included in the python path. So for my workflow, I figured out this solution:
settings.json file :
{
"terminal.integrated.env.windows": {
"PYTHONPATH":"${env:PYTHONPATH};${workspaceFolder}",
},
"terminal.integrated.env.linux": {
"PYTHONPATH":"${env:PYTHONPATH}:${workspaceFolder}",
},
"python.envFile": "${workspaceFolder}/.env"
}
.env file :
# PYTHONPATH="${PYTHONPATH}:${workspaceFolder}"
PYTHONPATH="${PYTHONPATH};${workspaceFolder}"
It works but as you see, each time I swith from Linux to Windows, I have to swap the PYTHON PATH (";" for windows and ":" for Linux). And of course, I'd like to avoid that.
Please note that :
- I don't use virtual environnement in this workflow for specific reasons
- the python.envFile parameter is used by the debugger, not the run.