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 eryksun
Recipients Anthony Sottile, RubyTuesdayDONO, brian.curtin, dabrahams, docs@python, eryksun, mark, pepalogik, r.david.murray
Date 2021-03-05.15:23:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The Popen() docs begin by explaining that it has "os.execvp()-like" behavior in POSIX and uses CreateProcess() in Windows. Personally, I do not think it's proper for Python's documentation to discuss details of  how CreateProcess() handles lpCommandLine (args), lpApplicationName (executable), lpCurrentDirectory (cwd), and lpEnvironment (env). So maybe all this needs is to clearly map Popen() parameters to the corresponding CreateProcess() parameters.

If Popen() implements a parameter on its own, then it makes sense to me to document the behavior. For example, in POSIX the behavior of `cwd` is implemented by Popen(), and documented as follows:

    In particular, the function looks for executable (or for the first 
    item in args) relative to cwd if the executable path is a relative

This claim is not always true in POSIX since a base filename without a slash in it, which is a relative path, is not searched for in the current directory unless "." is in PATH. But the main problem with the above sentence is the lack of a disclaimer that it only applies to POSIX. In Windows, `cwd` is passed through directly as the lpCurrentDirectory of CreateProcess(). This parameter sets the working directory of the child process and has nothing to do with searching for an executable parsed out of lpCommandLine or resolving a relative path in lpApplicationName. It may affect the result with shell=True, but even in that case there are caveats. Regardless, Python doesn't do anything with `cwd` in Windows except pass it to CreateProcess(), so the cwd -> lpCurrentDirectory parameter mapping is all there is to document.
Date User Action Args
2021-03-05 15:23:08eryksunsetrecipients: + eryksun, mark, r.david.murray, brian.curtin, docs@python, dabrahams, RubyTuesdayDONO, pepalogik, Anthony Sottile
2021-03-05 15:23:08eryksunsetmessageid: <>
2021-03-05 15:23:08eryksunlinkissue8557 messages
2021-03-05 15:23:07eryksuncreate