xml.dom.minidom bug ?

Diez B. Roggisch deets at nospam.web.de
Mon Dec 8 16:47:58 EST 2008


Sampsa Riikonen schrieb:
> Dear All,
> 
> I am experiencing a weird problem with the 
> xml.dom.minidom module:
> ----------------------------------------
> sampsa at linux-ty84:~/python> python easyxml.py
> Traceback (most recent call last):
>   File "easyxml.py", line 1, in <module>
>     import xml.dom.minidom
>   File "/usr/lib64/python2.5/site-packages/_xmlplus/dom/__init__.py", line
> 236, in <module>
>     import MessageSource
>   File "/usr/lib64/python2.5/site-packages/_xmlplus/dom/MessageSource.py",
> line 21, in <module>
>     _ = get_translator("dom")
>   File "/usr/lib64/python2.5/site-packages/_xmlplus/FtCore.py", line 54, in
> get_translator
>     f = gettext.translation('4Suite', locale_dir).gettext
>   File "/usr/lib64/python2.5/gettext.py", line 478, in translation
>     t = _translations.setdefault(key, class_(open(mofile, 'rb')))
>   File "/usr/lib64/python2.5/gettext.py", line 180, in __init__
>     self._parse(fp)
>   File "/usr/lib64/python2.5/gettext.py", line 264, in _parse
>     unpack = struct.unpack
> AttributeError: 'module' object has no attribute 'unpack'
> -------------------
> 
> A bug in the module?
> 
> And the weirdest thing is that I figured out how to
> get around this problem long time ago, but now I don't
> have a clue anymore... :/
> 
> Any help appreciated.

You don't happen to have a struct.py or struct.pyc lying around? To test 
this, execute *in the same directory your above code fails!!*

$ python
 >>> import struct
 >>> struct.__file__


The result should be something below /usr/lib/python2.5/, if it's not - 
that's your culprit.

Diez



More information about the Python-list mailing list