Problem with MySQLdb and mod_python

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


Hi,

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):
    db=MySQLdb.connect(user="xxx",passwd="xxx",host="xxx.xxx",db="xxx")
    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__
'1.2.2'
>>> import mod_python
>>> mod_python.version
'3.3.1'
---------------------------------

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

Thanks in advance,

Cyril BAZIN



More information about the Python-list mailing list