Hi there,

I'm trying to understand how module imports work, and am seeing some behavior I don't understand:

>>> import django
>>> from django import forms
>>> from forms import DecimalField
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named forms
>>> import django.contrib
>>> from django.contrib import auth
>>> from auth import ImproperlyConfigured
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named auth


So what I'm seeing is that you can import X, then from X import Y, but only if Y is another module and not an object. The import chains above work until I try to import a class definition. Can someone explain what it is about module imports that makes it work this way? And why the unhelpful error message?

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

Reply via email to