Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Unable to run a Python module in a subprocess when `subProcess: true`

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

@rchiodo đang làm issue này rồi.

Từ ngày 23/2/2026.

Đánh giá

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

Mô tả

bug Fixed in next release

The following script executes a Python module in a subprocess.

# main.py
import subprocess
import sys

subprocess.run([sys.executable, "-m", "sub"])
# sub.py
print("Hello, world!")
// launch.json
{
    "version": "0.2.0",
    "configurations": [
    
        {
            "name": "Python Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "subProcess": true,
        }
    ]
}

Running this in the debugger with "subProcess": true fails:

bash-3.2$  cd /Users/pete/projects/subprocess_test ; /usr/bin/env /Users/pete/projects/subprocess_test/.venv/bin/python /Users/pete/.vscode/extensions/ms-python.debugpy-2025.18.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher 56894 -- /Users/pete/projects/subprocess_test/main.py 
No module named sub

Running it with "subProcess": false works as expected:

bash-3.2$  cd /Users/pete/projects/subprocess_test ; /usr/bin/env /Users/pete/projects/subprocess_test/.venv/bin/python /Users/pete/.vscode/extensions/ms-python.debugpy-2025.18.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher 57618 -- /Users/pete/projects/subprocess_test/main.py 
Hello, world!

OS: Darwin arm64 25.3.0
VSCode: 1.109.5 (Universal)
Python Debugger: 2025.18.0
Python: 3.14.2 (in a virtualenv)

Ngôn ngữ chính
Python
Star
2.5k
Fork
202
Merge trung bình
5 ngày 1 giờ
Pull request đã merge (30 ngày)
1

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.

Issue khác của microsoft/debugpy

Tất cả issue của microsoft/debugpy

Issue tương tự

Thêm issue về Python

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.