◐ Shell
clean mode source ↗

Make `:PymodeRun` execute with the activated virtualenv interpreter by Copilot · Pull Request #1200 · python-mode/python-mode

Copilot AI linked an issue

Apr 21, 2026

that may be closed by this pull request

Copilot AI changed the title [WIP] Fix virtual environment activation issue in Pymode Make :PymodeRun execute with the activated virtualenv interpreter

Apr 21, 2026
- Set __file__ correctly in subprocess so user code referencing it sees
  the real source path instead of a temp file path
- Rewrite temp file paths in subprocess tracebacks to the real source file
- Add explicit UTF-8 encoding to subprocess Popen call
- Add g:pymode_run_timeout support with TimeoutExpired handling to
  prevent Vim from hanging on non-terminating scripts
- Restore sys.stdout/sys.stderr before returning on SystemExit with
  non-false exit code (pre-existing leak)
- Fix test: use fnameescape() instead of string() for PymodeVirtualenv
  argument (string() wraps in quotes, producing a malformed path)
- Save and restore g:pymode_virtualenv_enabled/g:pymode_virtualenv in
  the test to avoid polluting subsequent tests
- Remove misleading Assert 1 "skip" patterns; drop unreachable else
  branches so cleanup runs unconditionally

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

This was referenced

May 24, 2026