Skip to content

Debugger doesn't quote paths with spaces #767

@CoryAlbrecht

Description

@CoryAlbrecht

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:

  1. Make a python project in a directory that has spaces in the path.
  2. Try to debug with VScode using "type": "debugpy" in launch.json.
  3. Watch it fail.

Metadata

Metadata

Assignees

Labels

info-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions