my Python lib is broken

Bruno Rezende brunovianarezende at gmail.com
Sat Oct 6 14:37:04 CEST 2007


Thanks for the information! Indeed, I was geting an error when trying
to do:

from xml.dom import minidom

but it was because there is a xml.py file inside the same package, so
it happens a conflict...

On Oct 6, 9:22 am, "Guilherme Polo" <ggp... at gmail.com> wrote:
> 2007/10/6, Bruno Rezende <brunovianareze... at gmail.com>:
>
> > Hi,
>
> > I think I've broken my python installation (don't know how). All the
> > packages that are under 'lib' in python installation doesn't work the
> > way expected:
>
> > >>> import xml
> > >>> xml.dom
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> > AttributeError: 'module' object has no attribute 'dom'
>
> This is not broken. It is how packages works.
> xml is a package, dom is a package inside xml. If you want to check
> the attributes that you get importing xml you do dir(xml)
>
> > but, if I import * from xml, it starts to work again:
>
> > >>> from xml import *
>
> Doing that will cause the __init__.py inside package xml to check its
> __all__ list and import them all, including dom
>
> > >>> xml.dom
> > <module 'xml.dom' from 'C:\Python25\Lib\xml\dom\__init__.pyc'>
>
> > Does someone know why is this happening? (I can reinstall my python
> > 2.5, but would like to know how the python lib got broken).
>
> This is hapenning because you have installed Python, congratulations =)
>
>
>
> > regards,
> > Bruno
>
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> --
> -- Guilherme H. Polo Goncalves





More information about the Python-list mailing list