mod_python and xml.dom.minidom

dpapathanasiou denis.papathanasiou at gmail.com
Mon May 11 17:59:20 CEST 2009


For the record, and in case anyone else runs into this particular
problem, here's how resolved it.

My original xml_utils.py was written this way:

from xml.dom import minidom

def parse_item_attribute (item, attribute_name):
    item_doc = minidom.parseString(item)
    ...

That version worked under the python interpreter, but failed under
both mod_python and mod_wsgi apache modules with an error ("Parent
module 'xml.dom' not loaded").

I found that changing the import statement and the minidom reference
within the function resolved the problem.

I.e., after rewriting xml_utils.py this way, it works under both
apache modules as well as in the python interpreter:

import xml.dom.minidom

def parse_item_attribute (item, attribute_name):
    item_doc = xml.dom.minidom.parseString(item)
    ...




More information about the Python-list mailing list