[issue30783] Spawned subprocesses don't respect environment

2017-06-26 Thread Eryk Sun
Eryk Sun added the comment: cmd.exe implements its own search, like shutil.which, and uses the CreateProcess lpApplicationName parameter that corresponds to the Popen executable parameter. But in general (not always) it's better to use shutil.which because you don't have to worry about the

[issue30783] Spawned subprocesses don't respect environment

2017-06-26 Thread Ofek Lev
Ofek Lev added the comment: Fixed with shell=True -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue30783] Spawned subprocesses don't respect environment

2017-06-26 Thread Eryk Sun
Eryk Sun added the comment: subprocess.Popen calls CreateProcess on Windows, which searches for an unqualified executable in the command line as follows: 1. The directory from which the application loaded. 2. The current directory for the parent process. (Starting with Vista,

[issue30783] Spawned subprocesses don't respect environment

2017-06-26 Thread Ofek Lev
New submission from Ofek Lev: The following example shows that we are indeed changing PATH, but the subprocess does not acknowledge it in Windows 7 x64. Also note this works in Linux (Ubuntu 16.04). - import os import subprocess from contextlib import contextmanager from tempfile import