.pth files in working directory

Peter Hansen peter at engcorp.com
Wed Aug 31 15:18:31 CEST 2005

Peter Maas wrote:
> Peter Hansen schrieb:
>> generally such non-standard sys.path and .pth manipulations are best 
>> handled by a sitecustomize.py file, possibly which makes its own calls 
>> to site.addsitedir() and such.  Try "help(site)" for more.
> But sitecustomize.py changes the Python installation, doesn't it?
> This wouldn't be an advantage over putting a .pth file into
> .../site-packages.

You can have a local sitecustomize.py in the current directory, which 
wouldn't change the Python installation.  Would that help?

As far as I can tell, the current directory isn't added to the sys.path 
until after site.py executes, so I don't believe you can rely on .pth 
files to do anything like what you want.  Sitecustomize.py is it, with 
appropriate smarts inside.


More information about the Python-list mailing list