Windows: subprocess won't run different Python interpreter
Thorsten Kampe
thorsten at thorstenkampe.de
Thu Nov 10 16:58:07 EST 2016
Hi,
I'm trying to run a script with a different Python version by
extending the path variable and executing "python.exe". It looks like
subprocess will always run the current executing Python.
The following snippet demonstrates the problem:
"""
import os, subprocess
os.environ['PATH'] = ''
print(subprocess.check_output(['python.exe', '-V']))
"""
It outputs the version of the current executing Python interpreter
although it should generate an error because Python is not in the
PATH.
Thorsten
More information about the Python-list
mailing list