.pth in current directory: Why doesn't it work as the documentation says?

David Lyon david.lyon at preisshare.net
Mon May 18 08:51:03 EDT 2009


On Mon, 18 May 2009 14:34:33 +0200, Philipp Hagemeister <phihag at phihag.de>
wrote:
> Yes, but that processing will add /example/ to sys.path, right?

It actually works the other way around. The directories listed in
sys.path are scanned for .pth files.

You can add packages by listing them inside a .PTH.

> I'm expecting .pth files in the current directory to be be processed,
> according to docs/install/. Christian Heimes already pointed out this is
> not the case; so I'm wondering whether this is a mistake in the
> documentation or just my faulty logic.

Perphaps you don't understand them yet.

.PTH files are for adding run-time packages.

May I ask why you are playing with .PTH files? they are a fairly
advanced sort of concept for describing where packages are located
to the python interpreter.

If you are using .PTH files... you should be using "import .." 
inside your code..

Regards

David



More information about the Python-list mailing list