Python Win installations and PYTHONPATH Confusion (WAS: Re: Python Path Blues)

Jeff Shannon jeff at ccvcorp.com
Fri Aug 17 13:11:11 EDT 2001


"Maan M. Hamze" wrote:

> What is important here is that this can be a BIG turn-off for beginners.
> It took me more than a day of tinkering with the registry while trying to
> make DCOracle2 and mxODBC packages for Python run correctly.  Then I
> discovered it was all a matter of adding PYTHONPATH into the environment in
> Win NT and Win ME (for Win ME through running msconfig  then going to
> Environment tab or creating a PYTHONPATH setting in autoexec.bat which
> updates the Win ME environment).

Well, there are other ways than tinkering with the registry, too.  Haven't tried
it myself, but I've heard that putting a python.pth file in the same directory
as your python.exe, will cause each line of the .pth file to be interpreted as a
path to add to sys.path.  On the other hand, I fiddled with my registry (on
Win95/98) to add directories to my path, and, while I don't recall *exactly*
what I did with it, it only took me a few tries to figure out.  I do agree that
this could be better documented, though...  but I suspect that, due to the ease
(and portability) of using .pth files, that it's not going to be a high
priority.

(for others' reference:  I  went to
HKLM/SOFTWARE/Python/PythonCore/2.0/PythonPath and modified the default value to
include the desired path)

Btw, part of the reason that PythonWin uses the registry differently than other
modules, is doubtless because most modules try to stay as portable as possible,
and obviously registry usage is *not* portable.  OTOH, PythonWin and the
win32all extensions are by definition non-portable.  Therefore, it seems to make
sense that they behave like good Windows programs, and use the registry to store
their settings.  Indeed, some parts *require* using the registry--like, say
PythonCOM.  Yes, it makes things a less uniform... but I don't know that there's
any significantly better way of doing things.  If you really don't like the
registry behavior, you could go get PythonWare's distribution, which doesn't
touch the registry at all (and is designed to live happily alongside different
Python distro's....)  Of course, win32all will *still* require registry
settings, but... that's life in a multiplatform world, I'm afraid.

Jeff Shannon
Technician/Programmer
Credit International






More information about the Python-list mailing list