tags:

views:

57

answers:

2

Why is _mysql in the MySQLdb module a C file? When the module tries to import it, I get an import error. What should I do?

A: 

It's the adaptor that sits between the Python MySQLdb module and the C libmysqlclient library. One of the most common reasons for it not loading is that the appropriate libmysqlclient library is not in place.

Ignacio Vazquez-Abrams
A: 

Edit: This might be the answer to your question.

When I try to import _mysql, I get no error:

import _mysql
print(_mysql)
# <module '_mysql' from '/usr/lib/pymodules/python2.6/_mysql.so'>

It is importing the library /usr/lib/pymodules/python2.6/_mysql.so

If this is not what you are getting, it sounds like an installation error. What OS are you using? How did you install mysqldb?

unutbu
I'm using XP. I think I should try downloading and installing the module again. How should I go about that?