MySQLdb and cgi

robert anenem at gmail.com
Mon Oct 31 20:01:28 EST 2005


I am sending it again, since it didn't appear on the mailing list.

 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/20051101/6efbca26/attachment.html>


More information about the Python-list mailing list