[Python-Dev] Add python.exe to PATH environment variable

M.-A. Lemburg mal at egenix.com
Wed Sep 3 00:50:13 CEST 2008


On 2008-09-02 23:14, Terry Reedy wrote:
> Tarek Ziadé wrote:
> 
>> So I don't see any good reason (besides the technical complexity)
> 
> Unless and until someone is able and willing to deal with the technical
> complexity, that would seem to be a sufficient reason.
> 
>>  to [not, I presume] add  it to the Windows installer.
> 
>> So I would love to see this ticket open again; I personnaly would be
>> in favor of an automatic change of PATH by the installer.
> 
> Martin said he would discuss a patch when there is a patch to discuss.
> He feels strongly about there being a clean uninstall, including PATH
> restoration if it is changed.
> 
> The problem is that a) the Window's way to run user apps is via icons
> and menus and that b) the old DOS path/command way, based on Unix, has
> been neglected.
> 
> An alternative to manipulating PATH would be to make and add to the
> Start Menu a Command Prompt shortcut, call it Command Window or
> something, that starts in the Python directory.  Then one could enter
>>python or >Scripts/goforit without chdir-ing to the Python directory
> first.  The background could even be set to green, for instance, to
> differentiate it from the standard Command Prompt window.

There already is a menu entry that starts the Python interpreter
on Windows, so why not use that ?

Also .py files are automatically associated with the last installed
Python interpreter, so the double-clicking on .py files works and is
probably the most common way of starting a Python file on Windows.

Adding paths to the PATH variable is not easy on Windows, esp. if
you want to support multiple Windows versions. The global PATH
settings are not read from autoexec.bat anymore (only once at boot
time). Instead those environment variables are managed via the
registry.

See e.g.

http://agiletesting.blogspot.com/2005/06/handling-path-windows-registry-value.html

for how to setup PATH to your liking using Python.

The problem is: how to undo those changes without accidentally
undoing an explicit change made by the user ?

BTW: Adding the Python dir to the PATH per default would cause
problems for users who regularly have multiple different
Python installations on a machine. If this is done, it should
be an install option and not forced.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Sep 03 2008)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611


More information about the Python-Dev mailing list