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

David Lyon david.lyon at preisshare.net
Mon May 18 12:46:54 CEST 2009


On Mon, 18 May 2009 11:49:15 +0200, Philipp Hagemeister <phihag at phihag.de>
wrote:
> 1) According to http://docs.python.org/dev/install/, "The most
> convenient way is to add a path configuration file to a directory
that’s
> already on Python’s path, (...).

It's true...

> 2) Path configuration files have an extension of .pth, (...)"

Yes.

> 1&2 => 3) A file test.pth with the content "/example/" should result in
> sys.path containing "/example/".

No. Python, once finding the .pth will process it. 

> 
> 4) "" (the current directory) is the first element of my sys.path

Not always - but maybe it is. Let's not assume anything.

> 
> 1&4 => 5) The current directory qualifies for "a directory that’s
> already on Python’s path,"


> 
> 1&3&5 => 6) echo /example/ > test.pth; python -c 'import
> sys;print(repr(sys.path))' should contain '/example'.
> 
> 
> I think I misinterpreted the documentation, but what exactly is wrong
here?

What are you expecting? and maybe we can tell you why you aren't getting
it...

David



More information about the Python-list mailing list