microsoft / microsoft/vscode-python-debugger

debugpy does not quote spaces in command line arguments.

Đang mở
#820 15 bình luận 2 reaction 1 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

triage-needed
Ngôn ngữ chính
TypeScript
Star
180
Fork
126
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
3

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.