473,385 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

mod_python and xml.sax

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
Jul 18 '05 #1
2 1598
Jeffrey Froman wrote:
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.


iirc, both apache and python uses the expat parser; if you don't make sure
that both use the same expat version, you may get into trouble. this poster
claims to have a fix:

http://www.modpython.org/pipermail/m...ay/015569.html

</F>

Jul 18 '05 #2
Fredrik Lundh wrote:
iirc, both apache and python uses the expat parser; if you don't make sure
that both use the same expat version, you may get into trouble.
Thank you very much Fredrik, this does seem to be the problem I was having.
this
poster claims to have a fix:

http://www.modpython.org/pipermail/m...ay/015569.html


In fact two fixes are offered in this one short post :-) The second fix,
linking Python against the system Expat library, is specifically warned
against in Modules/Setup:

"""
#... Source of Expat 1.95.2 is included in
# Modules/expat/. Usage of a system shared libexpat.so/expat.dll is
# not advised.
"""

So I went with the first fix -- I upgraded the system library to Expat
1.95.8 to match the Expat bundled with Python 2.4 (the excerpt above is
apparently a little outdated). Everything is now working again.

Jeffrey
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: wolf | last post by:
i would like to briefly share my experiences with installing mod_python on a w2000 box. i must say that i believe the installation process to be unnecessarily complicated by the simple fact that...
2
by: Robert J. Hansen | last post by:
I'm not entirely certain comp.lang.python is the proper newsgroup for mod_python questions, but "comp.lang.python.web" doesn't seem to exist, so... my apologies in advance if this is considered...
0
by: Python_it | last post by:
I'm going to work with mod_python. I install mod_python 3.2.2b for python 2.4. If i test my install with mptest.py see this link:...
6
by: Anthony L. | last post by:
I am writing a web application that is comparable to a content management system used in blogging. I really want to use Python after having done some evaluation coding using Python 2.3.5 with...
1
by: treelife | last post by:
I'm getting and internal server error when | run the following mod_python script. I am actually trying to run Django. Script: from mod_python import apache def handler(req):...
2
by: exhuma.twn | last post by:
Hi again, as soon as I try to make use of the "session" object inside a psp-template file, I get the following error: Mod_python error: "PythonHandler mod_python.publisher" Traceback (most...
5
by: m.banaouas | last post by:
Hi, bonjour, witch versions are suitable to use for apache & mod_python ? Can i install and use "Apache 2.2.3" & "mod_python 3.2.10" (most recent versions) without facing any known major...
2
by: m.banaouas | last post by:
I installed Apache 2.2.3 and mod_python 3.2.10 on WinXP plateform I configured mod_python via httpd.conf: LoadModule python_module modules/mod_python.so but my script folder configuration...
3
by: Michael | last post by:
Hey everyone, Is it possible to automatically insert headers/footers using mod_python? I will be not be using PSP's, so I cannot use the PSP/include solution. Furthermore, the header will be...
3
by: joe jacob | last post by:
I configured apache to execute python scripts using mod_python handler. I followed below mentioned steps to configure apache. 1. In http.conf I added <Directory...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.