.pth files in working directory

Peter Maas peter at somewhere.com
Wed Aug 31 09:07:41 EDT 2005


Peter Hansen schrieb:
> Not sure from the above description exactly what it is you want,

I want a tree

top/
     install.py
     sub1/
         __init__.py
         mod1.py
     sub2/
         mod2.py

where I can do "from sub1 import mod1" in mod2.py no matter what the
absolute path of top is. To achieve this I start install.py once to
retrieve the absolute dir of itself (= abspath of top/) and creates
.pth files with its absolute dir in every subdirectory.

 > but
> 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.

-- 
-------------------------------------------------------------------
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------



More information about the Python-list mailing list