Hello all,

 

I'm just starting to use python seriously, and am having problems understanding exactly what is going on with import statements and the sys.path variable.

 

I'm trying to import classes and functions across several directories.  Here's a simple example of my filesystem:

/Defs

      base.py

      /One

            a.py

            b.py

      /Two

            c.py

 

In a.py I have:

###

import b

###

This results in an error:

ImportError: No module named b

 

My sys.path contains the absolute path to /Defs/One, so, if I'm understanding the import documentation (http://www.python.org/doc/current/ref/import.html), then the import statement should be searching the list of directories in sys.path, and finding it, but instead I get the ImportError.

 

I'm using Python 2.3.4 on Windows XP, using Xemacs to develop it and debug as I go using the interpreter.  Could this be something weird about how xemacs is running the code?

Thanks,
Ryan

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to