[Tutor] Module search path problem

Christer Enfors enfors at enfors.net
Tue Feb 27 11:28:10 CET 2007

I have two files, in the same directory: main.py, and user.py I have the 
following code in main.py:

   import user


   user_man = user.UserMan()

This works without problems.

But then I tried moving user.py to a subdirectory, and adding that 
directory to Python's module search path, so this is what main.py looks 
like now:

   import sys

   import user  # Generates no error message, so it's finding user.py


   user_man = user.UserMan()

But now I get an error message for the last line shown above:

   Traceback (most recent call last):
     File "./main.py", line 56, in ?
     File "./main.py", line 34, in boot
       user_man = user.UserMan()
   AttributeError: 'module' object has no attribute 'UserMan'

What's up with this?

More information about the Tutor mailing list