Parent process venv is not passed through to python subprocesses when using internalConsole
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
調査の方向性
提供されている test.py と .vscode/launch.json の再現手順から始め、internalConsole と integratedTerminal を比較します。debugpy が Python サブプロセスをどのように起動し、インターセプトするかを、PATH と VIRTUAL_ENV の伝播に重点を置いて追跡します。internalConsole で cowsay サブプロセスが実行され、サーバーが切断されたり、モジュールが見つからないエラーが発生したりしなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
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:
- Create a venv and install
cowsay - Open VS Code in the venv parent dir
- 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
}
]
}
- 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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/debugpy のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
microsoft/debugpy の issue をすべて見る
似ている issue
-
area: harness bug status: needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Human-Agent-Society/reef#625 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
learningequality/kolibri#15351 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Name consistency オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
eellak/triplestore#65 · コメント 1 件 ·