import error?
Peter Hansen
peter at engcorp.com
Thu Oct 16 06:35:18 EDT 2003
Tom wrote:
>
> I have a really strange problem. I have a module and at the beginning I
> include some others by:
> from xxx import *
> works perfectly except for one import. I always get an error saying:
> NameError: global name 'yyy' is not defined (yyy is a function in xxx)
Is there a complete trackback you could post? Then nobody would
have to guess what your problem is.
> I don't understand that. I checked everything and I have no typos in my
> code.
Obviously something is trying to access "yyy" before it actually
exists, so you must be missing something. Do you have a circular
reference in xxx? Are you aware that importing a module for the
first time actually causes any statements at module level to be
executed (which when the "def" and "class" statements are executed,
for example)?
-Peter
More information about the Python-list
mailing list