PTH files: Abs paths not working as expected. Symlinks needed?

poseidon p.oseidon at datec.at
Wed Feb 15 04:33:01 EST 2017


In /usr/lib/python3.6/site-packages I wrote a file tau4.pth. It contains 
the line

/home/poseidon/tau4/swr/py3/src

In /home/poseidon/tau4/swr/py3/src there's an __init__.py file, so it 
should be possible to write

import tau4

in my programs. But it isn't. Despite the fact that 
/home/poseidon/tau4/swr/py3/src is in sys.path, I get a ModuleNotFoundError.

It works, if I set a symlink to /home/poseidon/tau4/swr/py3/src in the 
site-packages dir:

ln -s /home/poseidon/tau4/swr/py3/src /usr/lib/python3.6/site-packages/tau4

https://docs.python.org/3.6/library/site.html suggests that PTH files 
only work relative to the site-packages dir. But digging around in e.g. 
StackOverflow I got the impression that absolute paths should work as 
well. If so, what am I doing wrong?

I'm on Arch Linux, Python 3.6.

Kind regards
Paul





More information about the Python-list mailing list