Question on Python path

Chris Liechti cliechti at gmx.net
Mon Feb 25 11:57:44 EST 2002


Gonçalo Rodrigues <op73418 at mail.telepac.pt> wrote in 
news:3qnk7ug977hk4peorufobtlo38nh8j9v87 at 4ax.com:

> I have put all my own modules in a subdirectory of site-packages. 
> How can I instruct Python (I'm using Python 2.2 on win2k) to also 
> look up this directory when a
> 
> import <whatever>
> 
> is found?

if you put it in site packeages it should be a package... this means 
the directory should have an __init__.py in it. then you can use it 
with
>>> import yourdir.yourmodule

or you can put your modules anywhere and create a ".pth" file with 
the path in it. this is appended on sys.path on startup.

and then there is the PYTHONPATH environment variable.

or you can add you path to sys.path in sitecustomize.py
-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list