How to set the working directory for debugging a Python program in VS Code?
python, visual-studio-code, vscode-debugger
Solution
Setting `"cwd"` to `${FileDirname}` in launch.json did not work for me; rather, I tried modifying settings.json, and actually got a solution.
In the settings.json file, add the field: `"python.terminal.executeInFileDir": true`
After adding this field, my settings.json looks something like:
{
"python.terminal.executeInFileDir": true
}
This will definitely set the cwd to the directory that contains your file, as opposed to the root folder of the project.
Problem
How do I execute a Python file with the debugger and specify the working directory for the run?