I am using vscode to write Python and when I run .py files they run from wirectory of workspace.
How can I get the file to run from the files dricetory instead of workspace directory?
I have tried setting this on: python.terminal.executeInFileDir
in settings but that did not change anything. On https://code.visualstudio.com/docs/python/settings-reference their explanation of this is exactly what I am trying to do but it does not work.
I have also tried several different variables in launch.json such as "cwd": "{$fileDirname}
, "cwd": "{$file}
, "cwd": "{$fileDirname}
.
My launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"cwd": "{$fileDirname}"
}
]
}