Parent process venv is not passed through to python subprocesses when using internalConsole
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the supplied test.py and .vscode/launch.json reproduction, comparing internalConsole with integratedTerminal. Trace how debugpy launches and intercepts Python subprocesses, focusing on PATH and VIRTUAL_ENV propagation. Done means the cowsay subprocess runs under internalConsole without the server disconnect or missing-module error.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 202
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/debugpy
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
All issues in microsoft/debugpy
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
rules
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
huggingface/Repo2RLEnv#163 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 95/100
huggingface/sentence-transformers#4074 ·
-
comp/dashboard invalid P3
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
NousResearch/hermes-agent#121143 ·