I have the following python code to access a MySQL database:
#!usr/bin/python
# server_version.py - retrieve and display database server version
import MySQLdb
con = MySQLdb.connect (host = "localhost",
user = "username",
passwd = "password",
db = "test")
cursor = conn.cursor ()
cursor.execute ("SELECT VERSION()")
row = cursor.fetchone ()
print "server version:", row(0)
cursor.close ()
conn.close ()
When I run it, I get the following error:
python mysql_server_version.py
Traceback (most recent call last):
File "mysql_server_version.py", line 4, in <module>
import MySQLdb
File "/home/rbushlow/python/MySQLdb.py", line 2, in <module>
import MySQLdb.cursors
ImportError: No module named cursors
Any Ideas what I need to do here?