module and CGI create a simple
database that can be accesed with a webpage.
Everything worked great up to this error when trying to load the
webpage:
ImportError: No module name MySQLdb
Note that I do NOT get the error when running the script normally from
Python.
So I'd say it has
module and CGI create a simple
database that can be accesed with a webpage.
Everything worked great up to this error when trying to load the
webpage:
ImportError: No module name MySQLdb
I hesitate to offer what seems like a simplistic solution: are the web
browser and the server running
Re-reading my message I noticed a stupid error, not effecting my
problem but annoying, I assigned variables and then did not use them,
then included import cgi for my regular script. This is how the command
line script should look:
#!/usr/bin/python
import MySQLdb
db=MySQLdb.connect(host =
This is the result of print sys.path:
print sys.path
['', '/usr/local/lib/python24.zip', '/usr/local/lib/python2.4',
'/usr/local/lib/python2.4/plat-linux2',
'/usr/local/lib/python2.4/lib-tk',
'/usr/local/lib/python2.4/lib-dynload',
'/usr/local/lib/python2.4/site-packages']
MySQLdb lives here
Here is the complete error from my Apache error log:
Traceback (most recent call last):
File /var/www/cgi-bin/mysqld_script_test.py, line 7, in ?
import MySQLdb
ImportError: No module named MySQLdb
[Thu Jan 26 07:25:16 2006] [error] [client 127.0.0.1] malformed header
from script. Bad
From what I can tell everything seems right. Here are the results of
the sys.path:
print sys.path
['', '/usr/local/lib/python24.zip', '/usr/local/lib/python2.4',
'/usr/local/lib/python2.4/plat-linux2',
'/usr/local/lib/python2.4/lib-tk',
'/usr/local/lib/python2.4/lib-dynload',
Fred wrote:
Here is the complete error from my Apache error log:
Traceback (most recent call last):
File /var/www/cgi-bin/mysqld_script_test.py, line 7, in ?
import MySQLdb
ImportError: No module named MySQLdb
[Thu Jan 26 07:25:16 2006] [error] [client 127.0.0.1] malformed header
Fred wrote:
Slackware Linux 10.2
Heh, Slackware was my first Linux distro. Version
2.2 I think. 1993 maybe?
Everything worked great up to this error when trying to load the
webpage:
ImportError: No module name MySQLdb
Some suggestions:
Start python interactively and try import MySQLdb
Magnus Lycka wrote:
Fred wrote:
Slackware Linux 10.2
Heh, Slackware was my first Linux distro. Version
2.2 I think. 1993 maybe?
I have been using Slackware since 1995, version 3.0 kernel 1.2.13
Some suggestions:
Finally, the cgitb module is pretty useful. I
suggest that you look it up:
I have discovered the possible problem (I can't check this until later
when I am home)
I think when I upgraded to Python 2.4.2 it created my problem.
Below is what is going on:
Default Slackware 10.2 install - 2.4.1 installed into
/usr/lib/python2.4
Python 2.4.1 upgraded to 2.4.2
Upgrade
Fixed...
All I did was change #!/usr/bin/python to #!/usr/local/bin/python
The page loaded right up it was loading Python ver 2.4.1 rather
than 2.4.2 where the MySQL db module was installed...
I knew it would be something easy... I learned something so it was
worth it...
--
a simple
database that can be accesed with a webpage.
Everything worked great up to this error when trying to load the
webpage:
ImportError: No module name MySQLdb
Note that I do NOT get the error when running the script normally from
Python.
I have read much but can not seem to nail the problem down
12 matches
Mail list logo