Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vscode working directory when debugging python

I have a simple problem regarding debugging python script on vscode .

When I open a parent directory on vs code that contains multiple children directories and then I open multiple python files from these children directories.

I then try to debug these files.

the problem is that from the launch.json the cwd is set up to be the parent folder. But I am now running a script in subfolders. and jumping from subfolder to subfolder.

So changing the "cwd": "workspaceRoot" every now and then isn't practical for me

is there a way that the debugger will always use the current folder of the debugged script file as the current directory??

p.s this question didn't help me stackoverfollow question

like image 978
stackunderflow Avatar asked May 05 '17 09:05

stackunderflow


1 Answers

try setting "cwd": "", in launch.json,

at least it works in the latest version, I can run python modules from root and subdirectories without changing launch settings (vs.code 1.16.1, python extension 0.7)

like image 83
L.Rtvri Avatar answered Oct 09 '22 20:10

L.Rtvri