Author sbt
Recipients Grissiom.Gu, cvrebert, sbt, terry.reedy
Date 2012-07-29.14:04:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> But I observe that the same script(with proper modification of file names) 
> works very well under Linux. After I dive into the source code, I found 
> Python use execvpe to invoke the child process which _will_ use the PATH 
> variable to search the executable.

The posix execvpe function does not use PATH from the passed environment, but (surprisingly to me) os.execvpe does.  subprocess in Python 3 no longer uses os.execvpe, but still goes out of its way to use envp['PATH'] on posix systems when searching for the executable.

So I think you have a legitimate complaint of inconsistency.

However, I don't think your suggested fix is a good idea since it (temporarily) changes the environment of the current process which might be problematic in a threaded program.

I am sure that Python 2.7 will not be patched to address this, but you might want to make a feature request for Python 3.4.
Date User Action Args
2012-07-29 14:04:54sbtsetrecipients: + sbt, terry.reedy, cvrebert, Grissiom.Gu
2012-07-29 14:04:54sbtsetmessageid: <>
2012-07-29 14:04:54sbtlinkissue15451 messages
2012-07-29 14:04:54sbtcreate