MySQLdb and cgi

robert anenem at gmail.com
Sun Oct 30 14:38:56 EST 2005


 Dear group,

I have a problem with importing MySQLdb in a cgi-script.
The code fragment at the beginning:

1 #!/usr/bin/env python
2
3 print "Content-Type: text/html\n\n"
4
5 import re
6 import cgi
7 import MySQLdb
8 print "something"

but the print statement in line 8 will never be executed. The Apache error
log says:
"No module named MySQLdb, referer: http://localhost/sqlForm.html"

But when executing the import statement outside of an cgi-script, for
example at the command line, the import works fine.
I assume, it has something to do with the apache. Why does the python
interpreter not find the MySQLdb module when executed in
apache context?

thanks, roebi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051030/71f6420c/attachment.html>


More information about the Python-list mailing list