Help! $PYTHONPATH trouble

Charles G Waldman cgw at fnal.gov
Fri Aug 13 00:33:15 CEST 1999


Erik Stewart writes:

 > $ PYTHONPATH="home/possum/test/kwp"
 > $ echo $PYTHONPATH
 > home/possum/test/kwp
 > $ python
 > Python 1.5.1 (#1, Mar 21 1999, 22:49:36)  [GCC egcs-2.91.66 19990314/Li
 > on linux-i386
 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
 > >>> import sys
 > >>> sys.path
 > ['', '/usr/lib/python1.5/', '/usr/lib/python1.5/test',
 > '/usr/lib/python1.5/plat-linux-i386', '/usr/lib/python1.5/lib-tk',
 > '/usr/lib/python1.5/lib-dynload', '/usr/lib/python1.5/site-packages']

Try exporting the variable.  The way you are setting it above, it becomes a
shell variable, not an environment variable - it's not inherited by
sub-processes.   I think if you do 

>>> import os
>>> printos.environ['PYTHONPATH']

you'll see that PYTHONPATH is in fact not in Python's environment.

Do "export PYTHONPATH" before starting Python and you'll get the
expected results.  Unless of course you have some other completely
different problem ;-)





More information about the Python-list mailing list