Path Puzzles

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Mar 8 20:15:31 EST 2000


dogboy777 at my-deja.com 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 parser.py and command.py,

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 cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-list mailing list