With the addition of the Python launcher (PEP 397), Python scripts on
Windows are executable in much the same way as on Unix. However, "out of
the box" it is still not quite possible to use Python scripts. This is
because the .py extension is not registered with Windows in the PATHEXT
environment variable (which holds all file extensions which should be
looked for on PATH at the command line).

There are two main consequences to this:

1. Under powershell, ".py" files on PATH are not found at all (this is not
the case with cmd.exe, and may be technically a bug in powershell - but
it's unlikely to change nevertheless).
2. Under both powershell and cmd, users have to explicitly include the
extension when invoking the command.

I would like to propose that the .py extension be added to PATHEXT as part
of the "Register Python Extensions" option in the Python MSI installer.
This would mean that Python users had a clean way of writing cross-platform
"wrapper scripts" and command-line applications out of the box, just by
writing a normal Python script with a #! line at the top.

Does anyone have any objections to this? I could try to write a patch, but
I know next to nothing about building MSIs, so if any of the installer
experts could help that would be fantastic.

Paul

PS There would still be one difference, in that scripts intended to be used
as commands would be named with '.py' on Windows and with no extension on
Unix, but that's a pretty trivial difference, and reflects fundamental
platform differences rather than configuration. So I don't propose worrying
about this.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to