This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author berdario
Recipients berdario, ezio.melotti
Date 2013-05-27.09:56:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1369648565.58.0.509591350639.issue18069@psf.upfronthosting.co.za>
In-reply-to
Content
I found out what's the problem, from the CreateProcess docs:

http://msdn.microsoft.com/en-us/library/ms682425.aspx

"""
If the file name does not contain a directory path, the system searches for the executable file in the following sequence:
The directory from which the application loaded.
The current directory for the parent process.
[...]
"""

This means that subprocess.Popen (and related functions) will always pick an executable in C:\PythonXX (if launched from the interpreter) or from C:\PythonXX\Scripts (if launched from a script/executable installed there) before looking into the PATH.

If we want to have the same behavior on *nix platforms and windows, I think that the only way this can be fixed, is by filtering the "executable" and "args" arguments through shutil.which (or a similar approach)

Otherwise, the difference in the executable path resolution should be documented.

(Either way, in my application, I'll have to reimplement shutil.which to be able to work on older python versions )
History
Date User Action Args
2013-05-27 09:56:05berdariosetrecipients: + berdario, ezio.melotti
2013-05-27 09:56:05berdariosetmessageid: <1369648565.58.0.509591350639.issue18069@psf.upfronthosting.co.za>
2013-05-27 09:56:05berdariolinkissue18069 messages
2013-05-27 09:56:05berdariocreate