[Pythonmac-SIG] PYTHONPATH problem

Jack Jansen Jack.Jansen@oratrix.com
Thu, 23 Jan 2003 22:29:43 +0100


On donderdag, jan 23, 2003, at 19:38 Europe/Amsterdam, Dave Hackenyos 
wrote:

> Hello,
> 	I am using the default installation of python2.2 on MACOSX 10.2 
> (jaguar). I have set the PYTHONPATH env variable in my shell start up 
> script to a place where I wish to load modules. But python fails to 
> find anything in that place. Running a test as follows:
>
> #! /usr/bin/python
> import sys
> print sys.path
>
> 		shows that python did not prepend the value of PYTHONPATH to the 
> sys.path information.

Sounds like something went wrong with setting the PYTHONPATH variable 
in your startup script. Maybe you're setting it in .login (which is for 
csh and tcsh) but you're using bash, or the other way around?

Try the following two shell commands:
echo $PYTHONPATH
sh -c 'echo $PYTHONPATH'
(Note: single quotes, not double quotes!).

If the first one fails you're not setting PYTHONPATH all all (the 
suggestion above, maybe?). If the first one prints the right value but 
the second one doesn't then you are setting the value, but you're not 
exporting it (in bash you need either the command "export 
PYTHONPATH=blabla" or the 2 commands "set PYTHONPATH=blabla" and 
"export PYTHONPATH". Just the "set" won't do the trick.
> --
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -