Problem with MySQLdb and mod_python

Cyril Bazin cyril.bazin at
Tue Jul 15 23:42:21 CEST 2008


I installed an apache server with mod_python.
I have got a problem with the mysql connection of my python script.

In fact I tried this file :
import os
os.environ["PYTHON_EGG_CACHE"] = "/tmp"
import MySQLdb
from mod_python import apache

def test(req):
    c = db.cursor()
    requete = "SELECT * FROM document"
    nbRows = c.execute(requete)
    req.write("Result : %s"%repr(nbRows))
    return apache.OK


But it seems, after many tests, that the script stops at the
instruction : "c.execute(requete)"
The script works if I am logged on the server as "root" or "www". I use :
Python 2.4.4 (#1, Oct 23 2006, 13:58:00)
[GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> MySQLdb.__version__
>>> import mod_python
>>> mod_python.version

If someone has any information that can help me...

Thanks in advance,


More information about the Python-list mailing list