Question on Python path

Gonçalo Rodrigues op73418 at
Mon Feb 25 12:20:46 EST 2002

On 25 Feb 2002 17:57:44 +0100, Chris Liechti <cliechti at> wrote:

>Gonçalo Rodrigues <op73418 at> wrote in 
>news:3qnk7ug977hk4peorufobtlo38nh8j9v87 at
>> 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 in it. then you can use it 
>>>> import yourdir.yourmodule

Hmmm... Now that you tell me it does seem obvious... *rolls eyes*

>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

This last one seems to be the best.

Gonçalo Rodrigues

More information about the Python-list mailing list