Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#1,678 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python, vscode
領域
devtools

調査の方向性

提供されている test.py と .vscode/launch.json の再現手順から始め、internalConsole と integratedTerminal を比較します。debugpy が Python サブプロセスをどのように起動し、インターセプトするかを、PATH と VIRTUAL_ENV の伝播に重点を置いて追跡します。internalConsole で cowsay サブプロセスが実行され、サーバーが切断されたり、モジュールが見つからないエラーが発生したりしなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
2.5k
フォーク
202
平均マージ
5日 1時間
マージ済み PR(30日)
1

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

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

はじめの一歩

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

microsoft/debugpy のほかの issue

microsoft/debugpy の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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