mod_python and xml.dom.minidom

dpapathanasiou denis.papathanasiou at gmail.com
Mon May 11 10:39:14 EDT 2009


> His problem is therefore likely to be something completely different.

You are correct.

As per the earlier advice, I switched from mod_python to mod_wsgi but
I still see the same error:

[Mon May 11 10:30:21 2009] [notice] Apache/2.2.11 (Unix) mod_wsgi/2.4
Python/2.5.2 configured -- resuming normal operations
[Mon May 11 10:30:26 2009] [error] Traceback (most recent call last):
[Mon May 11 10:30:26 2009] [error]   File "../db/items_db.py", line
38, in <lambda>
[Mon May 11 10:30:26 2009] [error]     db_object.associate(sdb_object,
(lambda primary_key, primary_data:xml_utils.parse_item_attribute
(primary_data, attribute)))
[Mon May 11 10:30:26 2009] [error]   File "../common/xml_utils.py",
line 80, in parse_item_attribute
[Mon May 11 10:30:26 2009] [error]     item_doc = minidom.parseString
(item)
[Mon May 11 10:30:26 2009] [error]   File "/usr/lib/python2.5/xml/dom/
minidom.py", line 1924, in parseString
[Mon May 11 10:30:26 2009] [error]     from xml.dom import
expatbuilder
[Mon May 11 10:30:26 2009] [error] SystemError: Parent module
'xml.dom' not loaded
[Mon May 11 10:30:26 2009] [error] Traceback (most recent call last):
[Mon May 11 10:30:26 2009] [error]   File "../db/items_db.py", line
38, in <lambda>
[Mon May 11 10:30:26 2009] [error]     db_object.associate(sdb_object,
(lambda primary_key, primary_data:xml_utils.parse_item_attribute
(primary_data, attribute)))
[Mon May 11 10:30:26 2009] [error]   File "../common/xml_utils.py",
line 80, in parse_item_attribute
[Mon May 11 10:30:26 2009] [error]     item_doc = minidom.parseString
(item)
[Mon May 11 10:30:26 2009] [error]   File "/usr/lib/python2.5/xml/dom/
minidom.py", line 1924, in parseString
[Mon May 11 10:30:26 2009] [error]     from xml.dom import
expatbuilder
[Mon May 11 10:30:26 2009] [error] SystemError: Parent module
'xml.dom' not loaded

The odd thing is that when xml_utils.py is run outside of either
apache module, xml.dom does load, and the minidom parsing works.

I'm not sure why this is happening, but the next thing I'll do is try
replacing minidom with ElementTree, and see if that has any issues
running under either apache module.



More information about the Python-list mailing list