Problems with PYTHONPATH
Question: From the command line (Mac OS), when I execute 'echo $PYTHONPATH' I get:

    
    
    > /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
    

If I then enter the Python interpreter and do the following:

    
    
    >>> import os
    >>> os.environ['PYTHONPATH']
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py", line 23, in __getitem__
        raise KeyError(key)
    KeyError: 'PYTHONPATH'
    

Why would this happen?


Answer: You forgot to export it to the environment so that subprocesses can access it;
it's currently only a bash variable.

    
    
    export PYTHONPATH
    

