[mod_python] libxml2 failure

Colin Fox cfox at cfconsulting.ca
Fri Feb 27 23:38:23 EST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Russell Balest wrote:
|
|   I've seen people asking this exact question a year ago and I don't see
| any answer to it.
| The problem is that libxml2 works fine as a standalone script and
| completely fails under mod_python.

Actually, I have it working perfectly under apache2 & mod_python. My setup:

Gentoo Linux:
libxml2 v 2.6.4
python 2.3.3
apache 2.0.48-r1
mod_python 3.0.4-r2

Here's a snippet from my processor:

~    def lowlevel_process(self, xml_filename, xsl_filename):
	libxml2.lineNumbersDefault(1)
	libxml2.substituteEntitiesDefault(1)

	styledoc = libxml2.parseFile(xsl_filename)
	style = libxslt.parseStylesheetDoc(styledoc)
	doc = libxml2.parseFile(xml_filename)

	result = style.applyStylesheet(doc, None)

	html = result.serialize()
	style.freeStylesheet()
	doc.freeDoc()
	result.freeDoc()
	return html

This works great, and is very fast.

Do you get anything in your /var/log/apache/error_log when you try to
process your xml?

cf
| Was there ever a resolution to this?
|
|   I can tell you my setup but this bug has been clearly stated many
| times before.  In fact, 4Suite is plagued by the same problems as libxml2.
|
|   Here is a minimal publisher handler which fails:
|
| --------------------------------------
|   def something(req):
|        styledoc = libxml2.parseFile("/tmp/template.xml")
|        # The value of styledoc is empty after this call.
|        # The file has an absolute pathname and exists in /tmp.
| --------------------------------------
| My httpd.conf file is fine because I can get other handles to work
| correctly.
| It's just libxml2 for some reason that doesn't work, and 4Suite.
|
|    My python version:
| ---------------------------------------
| Python 2.2.3 (#1, Nov 25 2003, 20:14:09)
| [GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
|
| ---------------
| Apache 1.3
| mod_python 2.3.8
|
|
|  Thanks for your suggestions (please!),
|   Russ Balest
|
| _______________________________________________
| Mod_python mailing list
| Mod_python at modpython.org
| http://mailman.modpython.org/mailman/listinfo/mod_python

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAQEVvoaQ1/feGlJoRApALAKCWs5TH77Tl8g3qhDF+9heSkaA7mgCfVt9p
xMRM+7NPRUOUPVhzjZcBDaA=
=orRR
-----END PGP SIGNATURE-----


More information about the Mod_python mailing list