Import problem

Scott David Daniels Scott.Daniels at Acm.Org
Mon Nov 22 09:17:07 EST 2004


Achim Domma (Procoders) wrote:
> Hi,
> 
> in my __init__.py of module A.B if have something like:
> ....
> 
> import A.B
> if A.B.VERSION[0]==5:  <- Error
>     do_something()
> 
> I get the error:
> AttributeError: 'module' object has no attribute 'B'

Do you have a file named "A.B.py"?  -- such names won't work.
If "A" is a package (directory), does it have a file "__init__.py"
and a file "B.py"?  If so, I don't have any more clues for you.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list