[Python-Dev] Re: Stability and change

Guido van Rossum guido@python.org
Sun, 07 Apr 2002 00:37:01 -0500


> [Guido]
> > ...
> > (Hm, would it be totally outrageous to let Python itself on Windows
> > check for a #! line, and when there is one that names an existing
> > Python interpreter that's not the current one, simply exec that one on
> > top of the current one???)
> 
> No, but how to name an existing interpreter is a problem: people
> don't install Python in the same locations, so an absolute path
> wouldn't be portable.  At least for the PythonLabs and ActiveState
> distros, we could use the version number to look up the installation
> path in the Windows registry (the PLabs and AS installers create
> registry entries to record this info, under a key path with
> major.minor in its name, although the PLabs distro has never *used*
> this info; I believe the PythonWare distro doesn't set any info in
> the registry).

Absolute paths aren't portable on Unix either, although

  #! /usr/bin/env python2.2

comes close.

I wouldn't mind if users who need this feature would be required to
know where their interpreter lives.  But I wouldn't mind a
registry-based solution either:

  #! python2.2

could mean "find Python 2.2 in the registry".

I believe the PythonWare distro always installs in the same place, so
if Fredrik thinks this will be useful, we could provide a hack that
looks in certain places on the filesystem if no registry key is found.

Still, I'd prefer to do the simplest thing that could possibly work,
which IMO would be just an absolute pathname.  It makes it *possible*
for a specific script to request a specific interpreter.  If you want
fancy, you can create an installer that figures out the right path and
sticks it in the #! line of scripts that need it at install time.

--Guido van Rossum (home page: http://www.python.org/~guido/)