On Tue, Mar 8, 2011 at 03:33, "Martin v. Löwis" <mar...@v.loewis.de> wrote: > If it's called "python.exe", I wonder what it should do when given a > file that doesn't carry version information.
I would expect it to follow the guidance of the Unix PEP as much as possible. IIRC this means it would launch the highest 2.x version of Python on the system. If there is no 2.x version, it would launch the highest known version (presumably 3.x) for now. I would expect this behavior for any unversioned name of the launcher (e.g. python.exe or pystart.exe). > Actually, the one Python script I run regularly is msi.py, and I > currently launch it in a terminal window, because I need to run it with > c:\python25\python.exe, which double-clicking won't do for me. If I > could double-click it, I would like that more (there is also the issue > that the script needs the VS envvars set, so I'd need to find a solution > to that, also). It's implicit scope creep, but perhaps the launcher could be configured to provide certain environment tweaks, either for all versions of Python, or specific for each version. A more extreme scope creep could allow this information to be stored in the .py file, but that seems backwards to me. To think a bit further on how the launcher should resolve the version, We should probably first see if the #! line works as an executable with optional single argument. This would allow someone to specify overrides like: #! D:\Checkout\...\python If the file doesn't exist, fall back to scanning for python[.exe] with or without a version (in order to support scripts with /usr/bin/python* or /usr/bin/env python*). If it has a version follow the version as closely as possible (map 2 to latest 2.x, 3 to latest 3.x, etc.). If it doesn't have a version, find the latest 2.x or latest any version as above, per the most recent relevant PEP. Open question is what to do if the script clearly requests version 2.6 but only 2.5, 2.7 and 3.2 are installed, or requests 2.x but only 3.x is installed; I could see erroring out as "refus[ing] the temptation to guess". -- Michael Urman _______________________________________________ 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