[Python-Dev] Finally fix installer to add Python to %PATH% on Windows

anatoly techtonik techtonik at gmail.com
Fri Jan 28 17:12:39 CET 2011


Hi, I'd like to

You probably know that after installation on Windows system it is
possible to call Python from Explorer's Run dialog (Win-R). It is
because Python path is added to App Paths registry key and Windows
Explorer shell checks this key when looking for executable.

But Python doesn't work from cmd session and, more importantly,
*Python doesn't work from .bat files*. It is because cmd shell doesn't
know about App Paths and relies on system PATH to find executable. As
far as I remember, there is no function in Python stdlib either, that
executes processes and does lookups in App Paths.

I never paid much attention to this fact, because I put several .bat
files for every 25, 26, 27, 31 and 32 version of Python into PATH
manually. But when bootstrap script for build environment of Native
Client (NaCl) said that I have no Python available and started to
install its own, I've asked myself - "How come? There are 5! possible
versions of Python on my system." It appeared that the following .bat
file doesn't work:

---cut mypy.bat--
python.exe
---cut mypy.bat--

C:\>mypy.bat

C:\>python.exe
'python.exe' is not recognized as an internal or external command,
operable program or batch file.


I've seen about 7 requests to add Python into %PATH% in installer. All
closed with no result, but with some fear and uncertainty. Martin
feared that MSI installers are not able to remove entry from PATH and
even if they can, they may kill the whole PATH instead of removing
just one entry.

To prove or dispel these fears, I've just installed/uninstalled
Mercurial from mercurial-1.7.3-1-x86.msi and App Engine from
GoogleAppEngine-1.4.1.msi several times. Both add entries to PATH and
both remove them without any further problems. Should we finally add
this to 3.2 installer for Python?

-- 
anatoly t.


More information about the Python-Dev mailing list