[Python-Dev] subprocess shell=True on Windows doesn't escape ^ character

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Jun 15 01:15:27 CEST 2014


>     On Thu, Jun 12, 2014 at 12:07 PM, Chris Angelico <rosuav at gmail.com
>     <mailto:rosuav at gmail.com>> wrote:
>      > ISTM what you want is not shell=True, but a separate function that
>      > follows the system policy for translating a command name into a
>      > path-to-binary.

According to the docs, subprocess.Popen should already be
doing this on Unix:

    On Unix, with shell=False (default): In this case, the Popen class
    uses os.execvp() to execute the child program.

and execvp() searches the user's PATH to find the program.

However, it says the Windows version uses CreateProcess, which
doesn't use PATH.

This seems like an unfortunate platform difference to me. It
would be better if PATH were searched on both platforms, or
better still, make it an option independent of shell=True.

-- 
Greg


More information about the Python-Dev mailing list