formulahendry / formulahendry/vscode-code-runner

[Bug] Runs Python script before activating the virtual environment

Open
#1,238 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.4k
Forks
351
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Running Python scripts fails because it tries sourcing the venv only after running the file.

```
✓ 57ms
Sandbox > python -u "c:\_MyFiles\Programming\Sandbox\main.py"
Traceback (most recent call last):
File "c:\_MyFiles\Programming\Sandbox\main.py", line 1, in
import sklearn
ModuleNotFoundError: No module named 'sklearn'

✗ 84ms
Sandbox > source /C/_MyFiles/Programming/Sandbox/.venv/Scripts/activate
```

- Code Runner Version: 2.2.5
- VS Code Version:
```
Version: 1.104.1 (system setup)
Commit: 0f0d87fa9e96c856c5212fc86db137ac0d783365
Date: 2025-09-17T23:36:24.973Z
Electron: 37.3.1
ElectronBuildId: 12404162
Chromium: 138.0.7204.235
Node.js: 22.18.0
V8: 13.8.258.31-electron.0
OS: Windows_NT x64 10.0.22631
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.