[Python-Dev] PEP 379 Python launcher for Windows - behaviour for #!/usr/bin/env python line is wrong

Vinay Sajip vinay_sajip at yahoo.co.uk
Sat May 4 16:20:57 CEST 2013

Paul Moore <p.f.moore <at> gmail.com> writes:

> This will mean that scripts written with #!/usr/bin/env python will
> behave the same on Unix and Windows in the presence of activated
> virtualenvs.

Overall I think it's the right result. There's one other compatibility
clarification: at the moment, as allowed by the PEP, you can have launcher
flags in a line that starts with #!/usr/bin/env python, for example

#!/usr/bin/env python3.2-32 -u

In such a case the launcher would use the 3.2-32 suffix to indicate that
32-bit Python 3.2 is wanted, and pass the -u to the launched executable. I
assume that this behaviour should continue, and the Posix-compatible behaviour
being proposed should only apply for lines that contain

"#!/usr/bin/env python"

followed by whitespace.

Also, since we're making a backwards incompatible change, do people feel that
it needs to be switched on only in the presence of e.g. an environment variable
such as PYLAUNCH_SEARCHPATH, or should we just change the default behaviour
now and risk breaking user scripts which may rely on the current behaviour?


Vinay Sajip

More information about the Python-Dev mailing list