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

Parent process venv is not passed through to python subprocesses when using internalConsole

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

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python, vscode
Lĩnh vực
devtools

Hướng nghiên cứu

Bắt đầu với bản tái hiện được cung cấp bằng test.py và .vscode/launch.json, so sánh internalConsole với integratedTerminal. Theo dõi cách debugpy khởi chạy và chặn các tiến trình con Python, tập trung vào việc truyền PATH và VIRTUAL_ENV. Công việc được xem là hoàn tất khi tiến trình con cowsay chạy dưới internalConsole mà máy chủ không bị ngắt kết nối và không xảy ra lỗi thiếu mô-đun.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug needs repro

Configuring "console": "internalConsole" for a launch target causes Python subprocesses spawned by the main debug process to not have their venv inherited correctly.

Repro. steps:
  1. Create a venv and install cowsay
  2. Open VS Code in the venv parent dir
  3. Create files as follows:

test.py:

import subprocess
stdout = subprocess.check_output(["python", "-m", "cowsay", "-t", "test"])
print(stdout.decode())

.vscode/launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: test.py",
            "type": "debugpy",
            "request": "launch",
            "program": "test.py",
            "console": "internalConsole", // Doesn't work
//            "console": "integratedTerminal", // Works
        }
    ]
}
  1. Launch the debug target
Actual outcome
  • Dialog box with "Server disconnected unexpectedly" displayed
  • "No module named cowsay" printed in debug console
Expected outcome
  • Subprocess runs without error
Notes

The underlying cause seems to be that the PATH and VIRTUAL_ENV env vars are not inherited correctly in spawned subprocesses when they are intercepted for debugging.

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.