[Python-Dev] Add python.exe to PATH environment variable (original) (raw)

Cesare Di Mauro cesare.dimauro at a-tono.com
Wed Sep 3 10:15:37 CEST 2008


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.

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.

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.

Cheers, Cesare



More information about the Python-Dev mailing list