Repository navigation
Debugger doesn't quote paths with spaces #767
Copy link
Copy link
Closed as not planned
Labels
info-neededIssue requires more information from posterIssue requires more information from postertriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Description
Before creating a new issue, please check the FAQ to see if your question is answered there.
Environment data
- debugpy version: 2025.10.0
- OS and version: Ubuntu Linux 22.04.1 LTS
- Python version (& distribution if applicable, e.g. Anaconda): Python 3.13.5
- Using VS Code or Visual Studio: VS Code
Version: 1.102.3
Commit: 488a1f239235055e34e673291fb8d8c810886f81
Date: 2025-07-29T03:00:23.339Z
Electron: 35.6.0
ElectronBuildId: 11847422
Chromium: 134.0.6998.205
Node.js: 22.15.1
V8: 13.4.114.21-electron.0
OS: Linux x64 6.8.0-72-generic
Actual behavior
Debugpy cannot handle spaces in folder names
/usr/bin/env /bin/python /home/cory/.vscode/extensions/ms-python.debugpy-2025.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 45117 -- /nfs/twilightsparkle.cory.albrecht.name/mnt/Archives/home/cory/Development/The Planet Monger/utilities/src/taps-query.py ${command:pickArgs}
cory@redbarchetta[17:02:38].../Development/The Planet Monger/utilities$ /usr/bin/env /bin/python /home/cory/.vscode/extensions/ms-python.debugpy-2025.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 45117 -- /nfs/twilightsparkle.cory.albrecht.name/mnt/Archives/home/cory/Development/The Planet Monger/utilities/src/taps-query.py ${command:pickArgs}
Traceback (most recent call last):
File "/usr/lib/python3.13/runpy.py", line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
"__main__", mod_spec)
File "/usr/lib/python3.13/runpy.py", line 88, in _run_code
exec(code, run_globals)
~~~~^^^^^^^^^^^^^^^^^^^
File "/home/cory/.vscode/extensions/ms-python.debugpy-2025.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 71, in <module>
cli.main()
~~~~~~~~^^
File "/home/cory/.vscode/extensions/ms-python.debugpy-2025.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 501, in main
run()
~~~^^
File "/home/cory/.vscode/extensions/ms-python.debugpy-2025.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 351, in run_file
runpy.run_path(target, run_name="__main__")
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cory/.vscode/extensions/ms-python.debugpy-2025.10.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 309, in run_path
code, fname = _get_code_from_file(run_name, path_name)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/cory/.vscode/extensions/ms-python.debugpy-2025.10.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 278, in _get_code_from_file
with io_open_code(decoded_path) as f:
~~~~~~~~~~~~^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/nfs/twilightsparkle.cory.albrecht.name/mnt/Archives/home/cory/Development/The'
Expected behaviour
That debugpy properly handle valid path names, like escaping spaces the way the soon-to-be retired "type": "python" in launch.json.
cory@redbarchetta[16:28:15].../Development/The Planet Monger/utilities$ /usr/bin/env /nfs/twilightsparkle.cory.albrecht.name/mnt/Archives/home/cory/Development/The\ Planet\ Monger/utilities/.venv/bin/python /home/cory/.vscode/extensions/ms-python.debugpy-2025.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 39967 -- /nfs/twilightsparkle.cory.albrecht.name/mnt/Archives/home/cory/Development/The\ Planet\ Monger/utilities/src/taps-query.py
Connecting to TAP service at https://simbad.u-strasbg.fr/simbad/sim-tap/...
Attempting login...
Steps to reproduce:
- Make a python project in a directory that has spaces in the path.
- Try to debug with VScode using "type": "debugpy" in launch.json.
- Watch it fail.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
info-neededIssue requires more information from posterIssue requires more information from postertriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Activity
rchiodo commentedon Aug 5, 2025
This should be a bug in the vscode-python-debugger extension. It needs to wrap the command line arguments in quotes (debugpy can't guess that the space is from a directory)
Transferring issue.
[-]Debugpy can't handle paces in path names[/-][+]Debugger doesn't quote paths with spaces[/+]CoryAlbrecht commentedon Aug 6, 2025
Same basic thing as microsoft/debugpy#1980 perhaps? Both have to do with vscode-python-debugger not understanding spaces, but that one is under Windows instead of Linux.
Also, #233 seems to be the same problem, though there was a bunch of misunderstanding by some people as to what the problem was.
Based on #233 I did a little bit of testing.
{ "version": "0.2.0", "configurations": [ { "name": "Python Debugger: Current File with Arguments", "type": "debugpy", "request": "launch", "program": "${file}", "console": "integratedTerminal", // "args": "${command:pickArgs}", "cwd": "${workspaceFolder}" } ] }That version of
launch.jsonworks:But uncomment that "args" line:
{ "version": "0.2.0", "configurations": [ { "name": "Python Debugger: Current File with Arguments", "type": "debugpy", "request": "launch", "program": "${file}", "console": "integratedTerminal", "args": "${command:pickArgs}", "cwd": "${workspaceFolder}" } ] }like that and the problem occurs whether you choose to enter any args
or not
But if you go an put the pickArgs in []s like "args" expects for mimicking multiple args on a command line:
{ "version": "0.2.0", "configurations": [ { "name": "Python Debugger: Current File with Arguments", "type": "debugpy", "request": "launch", "program": "${file}", "console": "integratedTerminal", "args": ["${command:pickArgs}"], "cwd": "${workspaceFolder}" } ] }Then the spaces in the script path get properly escaped but your args are also escaped, rendering the utility of ${command:pickArgs} for Python script debugging non-existent.
So whatever string-mashing vscode-python-debugger is doing before running a command line to start debugging, it appears to depend on what it sees as the value of the "args" parameter from launch.json.
I hope that helps narrow things down. :-)
eleanorjboyd commentedon Aug 14, 2025
Hi! If you uninstall the python environments extension does that fix the problem? We have an outstanding issue I am fixing regarding the envs extension causing this for others
github-actions commentedon Sep 14, 2025
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.
Happy Coding!