[Python-Dev] Adding Python scripts to PATHEXT on Windows (original) (raw)
Paul Moore p.f.moore at gmail.com
Mon Jul 15 10:26:50 CEST 2013
- Previous message: [Python-Dev] Why is the return value of __contains__ coerced to boolean, but that of __lt__ and the like is not?
- Next message: [Python-Dev] Adding Python scripts to PATHEXT on Windows
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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:
- 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).
- 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20130715/da10c602/attachment.html>
- Previous message: [Python-Dev] Why is the return value of __contains__ coerced to boolean, but that of __lt__ and the like is not?
- Next message: [Python-Dev] Adding Python scripts to PATHEXT on Windows
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]