berdario added the comment:

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 )

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18069>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to