'VSCode debugger ignores cwd configuration

I'm trying to debug a Python script I wrote, which loads files relative to its current directory, but no matter what I put in the cwd parameter in the launch.json file, the debugger says the files can't be found.

Running without debugging loads the files properly, but there's a problem elsewhere, which is why I need the debugger to work.

Here's my launch.json file right now:

{
    // 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}",
            "justMyCode": true
        }
    ]
}

I've tried setting cwd to the following, as per various answers I found here, on Stack Overflow:

"cwd": ""
"cwd": "."
"cwd": "${workspaceFolder}"

I've even tried a direct path to the script's folder (there are no spaces in the path, which was another potential problem I saw), which didn't work either.

I've tried restarting VSCode after every change to the cwd parameter, just in case. That didn't work either.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source