[mod_python] Expat-like parseString error

Joseph Bernhardt joe at incomps.com
Thu May 29 17:32:42 EDT 2008


Ok, after several hours I have solved my own problem.  Looking over the
contents of the xml.parsers.expat module, I discovered that all it does is
imports pyexpat.  Hhmm, so how could it give a lower version number than
importing pyexpat directly?  Well, I came to find out that there were two
versions of pyexpat in my sys.path, the older being supplied by PyXML
(http://pyxml.sourceforge.net/).  Since I never use PyXML anyway, I've
simply removed the reference.  

 

It works now.

 

Thanks for tuning in.

 

Joe

 

From: mod_python-bounces at modpython.org
[mailto:mod_python-bounces at modpython.org] On Behalf Of Joseph Bernhardt
Sent: Thursday, May 29, 2008 1:17 PM
To: mod_python at modpython.org
Subject: RE: [mod_python] Expat-like parseString error

 

I see that minidom actually uses the xml.parsers.expat module.  The version
information of this on my system is 1.95.8 and when imported in a mod_python
application will return a blank page:

 

from xml.parsers import expat

 

def index(req):

    return "blah"

 

Which is starting to make sense now, and that it is the conflict between
this version and the version that apache is trying to use.  My new question:
Is there any way to force minidom to use a different version of expat
(either 2.0.0 or 1.95.7, either of which I would assume would work)?  I
noticed there was an optional 'Parser' argument to the parseString function.
Is this something that would be helpful?  If not, I could probably update
apache.  At any rate, this is probably not a mod_python issue anymore, but I
still thank you in advance for any help you may provide.

 

Graham - thank you again for the documentation you provide in your websites.
They have been of great help so far.

 

Joe

 

 

I am experiencing an issue very similar to the one found here:

 

http://mail.python.org/pipermail/python-list/2007-January/424015.html

 

whereas as mod_python application will return a blank screen upon the
calling of parseString.  Example:

 

from xml.dom.minidom import parseString

 

def index(req):

    parseString("<info>stuff</info>")

    return "blah"

 

The funny thing is, I am using Python 2.5 with expat 2.0.0, and therefore
the expat bug should not apply, correct?  Apache is using expat 1.95.7.
Would that make a difference?   Perhaps it is something completely
different.  Also, importing expat works just fine:

 

import pyexpat

 

def index(req):

    return "blah"

 

and it returns what it should.  What else can I try to narrow down the
issue?  Or, is there some other documentation that someone can point me to?
I can't seem to find anything else.

 

Thanks in advance!

 

Joseph Bernhardt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20080529/8a5c4c9f/attachment.html


More information about the Mod_python mailing list