[Python-Dev] Adding Python scripts to PATHEXT on Windows

Paul Moore p.f.moore at gmail.com
Sun Jul 28 00:36:19 CEST 2013


On 27 July 2013 21:14, Steve Dower <Steve.Dower at microsoft.com> wrote:

>  Any chance of this being made optional when installing? It provides no
> benefit for people who prefer to associate scripts with an editor and may
> be a source of confusion/complaints.
>

Personally, I don't know how to do this so someone else would have to - but
if someone does, I won't particularly object. I'd prefer it to be on by
default, though (just like associating py.exe with scripts is) because
otherwise it's not reasonable to assume that a .py script will work as a
command in the same way that a bat file does - which is really the point of
wanting this in the first place.

I'm a bit confused by your comment about "people who prefer to associate
scripts with an editor", though. This is only done in precisely those
situations when the installer associates .py scripts with py.exe (the
launcher). So if you switch that off, you don't get PATHEXT either. And if
you change the association after the fact, you're presumably just as
capable of changing PATHEXT.

The key point here is that I want the *default* behaviour of Python when
installed using the standard msi to be that if I put a script foo.py on
PATH somewhere, then typing "foo" at the command line will run that script.
For that to be the case, PATHEXT needs to be set, and I view that as a
(minor) omission which was made when the association with py.exe was
implemented.

(Which reminds me - it would be nice if the standalone installer for the py
launcher included setting PATHEXT as well).


> Env var changes typically require a reboot to take full effect, which I've
> also seen cause confusion.
>

Really? If I add python.exe to PATH in the installer do I need to reboot?
(I never do this, so I don't know - it's a genuine question).

Also, it should include .pyw, .pyz and whatever was decided instead of
> .pywz (.pwz, I think?).
>

It's basically a command line thing - I don't see why you'd want to launch
a GUI script from the command line in the same way. But again, if someone
wants to do it, I don't really mind (in this case I know what to do, so if
there's consensus that it's needed, I can add it to the patch myself).

The PEP for pyz and pwz hasn't been accepted yet. If it does, then yes pyz
should be treated the same way (and we can have the same debate about pwz
as we do about pyw :-))

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130727/6c232ba8/attachment.html>


More information about the Python-Dev mailing list