mod_python and xml.sax

Jeffrey Froman jeffrey at fro.man
Mon Dec 20 10:55:35 EST 2004


I am having difficulty getting mod_python and xml.sax to play nicely with
each other. I am using:

Python 2.4
Mod_python 2.7.10
Apache 1.3.33

Using the mod_python.publisher handler to invoke the go function in the
following script:

from xml.sax import make_parser
def go():
    x = make_parser()
    return 'OK'

This is the entire script. The import works fine, but creating the parser
fails, producing no traceback, and no Apache errors, but apparently
crashing mod_python. A wget of the URL looks like:

~$ wget http://mysite.com/live/test.py/go
--07:41:51--  http://future.uselesstree.org/live/test.py/go
           => `go'
Resolving mysite.com ... 6x.xxx.xxx.xxx
Connecting to mysite.com[6x.xxx.xxx.xxx]:80... connected.
HTTP request sent, awaiting response... 
07:41:51 ERROR -1: No data received.

Changing the import scheme to import the entire xml.sax module, or
attempting to create the parser using xml.sax.parse() produces the same
results: mod_python crashes as soon as an attempt is made to create the
parser.

Searching on the web, I found one other person who claims to have a similar
problem with mod_python 2.7.8 and Python 2.3, but no solutions. Does anyone
here know a fix/workaround for this apparent incompatibility?

Thank you,
Jeffrey 



More information about the Python-list mailing list