MrT77
MrT77

Reputation: 963

VSCode does not let me set cwd in launch.json for debug

I've been using this setting in MacOs for a while without any problem, but since I changed to a new computer (MacOs M1) I can't make this work. Here is my configuration (from launch.json):

        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "cwd": "$(fileDirname)"
        }
    

If I set "cwd" to "", I can debug the program, but it doesn't start in the code folder, but rather in the Project/Workspace folder, which is not what I want. If I set "cwd" to "$(fileDirname)"(exactly as I had working in the other MacOs), I can not debug the program: after a while trying to connect I get a message "Timed out waiting for launcher to connect", with 2 buttons:"open launch.json" and "Cancel".

I'm using Code 1.59.1 in both computers with the same settings.

PS: After a reboot, I got the following errorenter image description here

It seems this is related to the new way of selecting default terminal (profile), but I believe my settings are correct: "terminal.integrated.defaultProfile.osx": "zsh", I tried with "bash", also without success.

Upvotes: 0

Views: 2231

Answers (1)

Philippe
Philippe

Reputation: 26592

You should put curly braces :

"cwd": "${fileDirname}"

(edited to correct "cwd" reference)

Upvotes: 1

Related Questions