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

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


On 2008-09-03 10:15, Cesare Di Mauro wrote:
> On 03 sep 2008 at 00:50:13, M.-A. Lemburg <mal at egenix.com> wrote:
> 
>> There already is a menu entry that starts the Python interpreter
>> on Windows, so why not use that ?
> 
> Because i need to start Python from folders which have
> files that define a specific "environment".
> 
> I have several servers and applications that develop and test this way.

Same here, but I usually have a env.bat that sets up whatever
environment I need (including the required Python version) and
run that when opening a prompt to work on a particular project.

>> 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.
> 
> 99% of time I run Python from a command prompt (on specific
> directories).
> 
> I use the default menu entry only when I have to play with Python to test some
> pieces of code.

IMHO, the only point of having the installer do this for the user
is for the case where the user does not know how to manipulate
PATH on Windows, but still wants to use the command line to access it
directly.

How many users would fit that category ?

>> 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.
> 
> Let the user to decide to update or not the PATH envar by marking a
> chechbox in the setup process, displaying that doing that the
> changes will NOT be reverted when uninstalling it.

Hmm, I don't think that's a good way to go about this. The uninstall
should undo all changes.

-- 
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