I don't have much experience with tcsh, but I am interested in learning. I've been having issues getting Python to see PYTHONPATH
. I can echo $PYTHONPATH
, and it is correct, but when I start up Python, my paths do not show up in sys.path
. Any ideas?
EDIT:
[dmcdonal@tg-steele ~]$ echo $PYTHONPATH
/home/ba01/u116/dmcdonal/PyCogent-v1.1
>>> from sys import path
>>> from os import environ
>>> path
['', '/apps/steele/Python-2.5.2/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg', '/apps/steele/Python-2.5.2/lib/python2.5/site-packages/FiPy-2.0-py2.5.egg', '/apps/steele/Python-2.5.2', '/apps/steele/Python-2.5.2/lib/python25.zip', '/apps/steele/Python-2.5.2/lib/python2.5', '/apps/steele/Python-2.5.2/lib/python2.5/plat-linux2', '/apps/steele/Python-2.5.2/lib/python2.5/lib-tk', '/apps/steele/Python-2.5.2/lib/python2.5/lib-dynload', '/apps/steele/Python-2.5.2/lib/python2.5/site-packages', '/apps/steele/Python-2.5.2/lib/python2.5/site-packages/Numeric']
>>> environ['PYTHONPATH']
'/apps/steele/Python-2.5.2'
How are you setting PYTHONPATH? You might be confusing tcsh's set vs. setenv. Use "set" to set what tcsh calls shell variables and use "setenv" to set environment variables. So, you need to use setenv in order for Python to see it. For example:
$ set FOO='bar'
$ echo $FOO
bar
$ python -c 'import os; print os.getenv("FOO")'
None
$ setenv BAR 'wiz'
$ echo $BAR
wiz
$ python -c 'import os; print os.getenv("BAR")'
wiz
There is some more information available in the variables section of the tcsh documentation.
Make sure that you're not starting python with the -E
option (which is: ignore environment variables). If you start python via a shell script or some other app, just double check it doesn't add anything.
Since the list of sys.path is long, it can be hard to miss your paths. PYTHONPATH stuff normally gets added to about the middle of the list, after all the library paths. Any chance your paths are there, just buried in the middle?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With