my Python lib is broken

Guilherme Polo ggpolo at
Sat Oct 6 14:22:30 CEST 2007

2007/10/6, Bruno Rezende <brunovianarezende at>:
> 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 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
> --

-- Guilherme H. Polo Goncalves

More information about the Python-list mailing list