Reputation: 759
Searching through this question, I was not able to find the information I need.
My dir structure in VS Code:
ProjectXYZ
|
-module1
My launch.json:
{
"name": "Main File: Python",
"type": "python",
"request": "launch",
"module": "module1",
"console": "integratedTerminal",
"justMyCode": true,
"args": ["--env", "DEV"]
}
Regardless of which file I'm on in VS Code, I want to debug module1
. I then want the cwd to be set to ProjectXYZ/module1 for other purposes. As is, the cwd at breakpoints is ProjectXYZ.
If I add "cwd": "${fileDirname}"
to the launch.json, it sets the cwd before opening the module and can no longer find my module. Possible values for "cwd" found here.
Is my setup possible purely in the launch.json or do I have to set the cwd immediately after launch (also I don't want to do this in production code, only when debugging in VS code).
Thanks!
Upvotes: 0
Views: 715
Reputation: 9727
You can set cwd to the absolute path of the ProjectXYZ/module1. you have found the documentation.
${fileDirname} - the current opened file's folder path
Set cwd to your desired folder.
Upvotes: 0