microsoft / microsoft/vscode-python-debugger

debugpy does not quote spaces in command line arguments.

Offen
#820 15 Kommentare 2 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

triage-needed
Vorherrschende Sprache
TypeScript
Sterne
180
Forks
126
Ø Merge
2 T. 3 Std.
Gemergte PRs (30 T.)
3

Beschreibung

Issue

When calling debugpy from command line using the vscode integrated terminal, it does not quote command line arguments.

I saw some similar issues (https://github.com/Microsoft/vscode-python-debugger/issues/767) but these were focused on launching the debugger using launch.json. This issue is about calling debugpy from the terminal.

How to reproduce

import sys
print(f"First arg is: '{sys.argv[1]}'")
print(f"Second arg is: '{sys.argv[2]}'") # should print 'hello world'

In a vscode terminal:

$ debugpy /path/to/script.py hi "hello world"
First arg is: 'hi'
Second arg is: 'hello'

Conclusion

This seems to be caused by a wrapper script this extension ships.

$ which debugpy
~/.vscode/extensions/ms-python.debugpy-2025.10.0-linux-x64/bundled/scripts/noConfigScripts/debugpy

which has:

#! /bin/bash
# Bash script
export DEBUGPY_ADAPTER_ENDPOINTS=$VSCODE_DEBUGPY_ADAPTER_ENDPOINTS
python3 $BUNDLED_DEBUGPY_PATH --listen 0 --wait-for-client $@

The actual command this script ended up executing is:

$ python3 /path/to/.vscode/extensions/ms-python.debugpy-2025.10.0-linux-x64/bundled/libs/debugpy --listen 0 --wait-for-client path/to/script.py hi hello world

As a workaround i changed that wrapper script to use "$@" instead of $@. I'm not sure if this is the correct fix for everyone but worked for my humble usecase :)

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.