Example:
import MySQLdb
conn = MySQLdb.connect(passwd="passwd", db="mydb")
cursor = conn.cursor()
cursor.execute("""SELECT * FROM table""")
records = cursor.fatchone()
print records
provides the next error:
Traceback (most recent call last): File
"/Applications/eclipse/plugins/org.python.pydev.debug_2.2.2.2011100512/pysrc/pydevd.py",
line 1267, in
debugger.run(setup['file'], None, None) File "/Applications/eclipse/plugins/org.python.pydev.debug_2.2.2.2011100512/pysrc/pydevd.py", line 1020, in run
pydev_imports.execfile(file, globals, locals) #execute the script File "/Users/user/Documents.Develop/workspace/myProject/src/Main.py",
line 56, in
import MySQLdb File "build/bdist.macosx-10.7-intel/egg/MySQLdb/init.py", line 19, in
File "build/bdist.macosx-10.7-intel/egg/_mysql.py", line 7,
in File "build/bdist.macosx-10.7-intel/egg/_mysql.py", line
6, in bootstrap ImportError:
dlopen(/Users/user/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so,
2): Library not loaded: libmysqlclient.18.dylib Referenced from:
/Users/user/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so
Reason: image not found
Where's the error?