Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python .pth Files Aren't Working

Directories listed in my .pth configuration file aren't appearing in sys.path.

The contents of configuration file, named some_code_dirs.pth:

/home/project

Paths to the file:

/usr/lib/python2.6/site-packages/some_code_dirs.pth
/usr/lib/python2.6/some_code_dirs.pth

Check on sys variables in the python interpreter:

>>> print sys.prefix 
'/usr'
>>> print sys.exec_prefix
'/usr'

All this seems as required in the Python documentation, but sys.path doesn't include the /home/project directory.

Note that the interpreter does add the directory after:

>>> site.addsitedir('/usr/lib/python2.6/site-packages') 

What am I missing here?

like image 855
chernevik Avatar asked Sep 02 '09 20:09

chernevik


1 Answers

What OS are you using? On my Ubuntu 9.04 system that directory is not in sys.path. Try putting it into /usr/lib/python2.6/dist-packages. Notice that it is dist instead of site.

like image 158
Isaiah Avatar answered Nov 07 '22 05:11

Isaiah