microsoft / microsoft/vscode-python-debugger

debugpy does not quote spaces in command line arguments.

オープン
#820 コメント 15 件 リアクション 2 件 担当者 1 名 GitHub で見る

まだ誰も着手していません。

triage-needed
主要言語
TypeScript
スター
180
フォーク
126
平均マージ
2日 3時間
マージ済み PR(30日)
3

説明

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 :)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。