packages in special directories?

Michal Wallace sabren at manifestation.com
Wed Feb 16 07:55:07 CET 2000


Hey all,

How can I make a .pth file point outside the main python directory?

I have my package development directory organized like this:

c:\zike\code\weblib
c:\zike\code\weblib\__init__.py
c:\zike\code\weblib\Sess.py
c:\zike\code\weblib\Auth.py
c:\zike\code\weblib\Perm.py

I like having my code under \zike\code for backup purposes,
and to keep it seperate from work I do for other companies, etc.

Anyway, I want to be able to "import weblib" ... I know I can put
it in PYTHONPATH, but that's already messy, so I wanted to
try out the .pth notation..

so I made:

c:\program files\python\weblib.pth

which contains one line:

c:\zike\code\weblib

... but this doesn't work.... neither does:

..\..\zike\code\weblib

So I settled (for now) with changing it to:

weblib

and making a fake c:\program files\python\weblib\__init__.py
which just appends the real directory to __path__...

But why doesn't the other way work? I'd think this would come
in handy, for example, if you have one version in production and
are working on another... ??

-Michal
http://www.sabren.com/






More information about the Python-list mailing list