[Tutor] Changing Pythonpath

Christian Tismer tismer@appliedbiometrics.com
Mon, 24 May 1999 13:25:05 +0200


John Hirsch wrote:
> 
> Hi
> How do you make a permanant change to PYTHONPATH in Windows 95.
> I want Python to look in one of my folders for modules and I can get it
> to work using sys.path.append(). But this does not make a permanant
> change to the path so when I exit Python and then come back in the path
> is reset to what it was and I have to do a sys.path.append() again. I'm
> sure this is something quite basic but most documentation seems to refer
> to Unix (using $ PYTHONPATH).
> Thanks for any help.

You have several options.
You can of course set the PYTHONPATH environment
variable in your autoexec.bat. This setting will prepend
all other settings in the Windows registry.

Then, in PythonWin, you can use the Path editor to adjust your
Path permanently. Unfortunately, new entries cannot be
added, but existing ones can be modified. There is one
entry per installed extension. You will probably change
the main entry.

The third way (and this is what I personally like the best)
is to have a sitecustomize.py file in your Python main 
directory. This file can be used to change any setting,
including the sys.path, since it will be run on every
start of Python.

You might also want to read more on path configuration
in chapter 3.26 site -- Site-specific configuration hook 
of the Python Library Reference.

<Side note>
The help files are also available in MSHTML format, which
is much easier to work with than plain HTML. By adding a single
registry key, you can make it appear in PythonWin's help
menu. Put the folling lines (after editing) into a .reg
file and execute it, and you're done.
After you have created such a key, it can also be edited by
the PythonWin path tool.

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\1.5\Help]

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\1.5\Help\Python-MSHTML-Help]
@="\\\\orion\\install\\python1.5\\doc\\pythlp.chm"

</Side note>

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home