Package Question - please help.

Jason Orendorff jason at jorendorff.com
Sat Dec 15 00:39:05 EST 2001


> from package1.subpackage1.myCode import MyClass

This looks for the file
  package1\subpackage1\myCode.py
in the directories on your path.

> I've added c:\package1 to the path

That would become:
  c:\package1\package1\subpackage1\myCode.py

If you were to add C:\ to your pythonpath, it would work.
Or you could move the whole directory try under C:\myproject
and add C:\myproject to your pythonpath.

> (by adding it in the registy -- is there an easier way?).

Sure.  You can use the PYTHONPATH environment variable
or your Python program can modify the sys.path variable at runtime.

-- 
Jason Orendorff    http://www.jorendorff.com/





More information about the Python-list mailing list