Path Puzzles

Greg Ewing greg at
Thu Mar 9 02:15:31 CET 2000

dogboy777 at wrote:
> every time I create a new
> project which will have its own test subdirectory, I've got to change
> PYTHONPATH.  There's got to be a better way, right?

On unix you can make a symbolic link from the test directory
to the module being tested.

On DOS, you could put ".." in PYTHONPATH, and then cd to the test
directory before running the script.

> Is this because Python already has modules
> further up the PYTHONPATH called and,

Quite likely, especially if these modules have already been imported
before you try to import your own. In any case, it doesn't seem like
a good idea to have two different top-level modules around with the
same name!

Greg Ewing, Computer Science Dept,
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at	   +--------------------------------------+

More information about the Python-list mailing list