Bad hack fix around a bizarre problem...
Diez B. Roggisch
deets at nospam.web.de
Sun Jan 11 08:08:06 EST 2009
Just Another Victim of the Ambient Morality schrieb:
> I'm trying to write a Python program that manipulates a MySQL database
> and have chosen to use MySQLdb. So, I used by system's package manager,
> YUM, and it appeared to install correctly. So, I tried it out and got this
> error:
>
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "MySQLdb/__init__.py", line 22, in ?
> raise ImportError, "this is MySQLdb version %s, but _mysql is version
> %r" %\
> ImportError: this is MySQLdb version (1, 2, 2, 'final', 0), but _mysql is
> version (1, 2, 1, 'final', 1)
>
>
> It looks like the MySQLdb version doesn't match the _mysql version. If
> these were two different libraries, I might understand how this error
> happened. However, they're part of the same library. _mysql is just a
> Python binding to the MySQL C API and MySQLdb is just a Python wrapper
> around _mysql to be compliant with the Python DB specification. They were
> both part of the same library so how did their versions fall out of sync?
> That's like getting a Windows application with incompatible DLLs!
>
> So, my bad hack of a fix is to copy the MySQLdb python code to a local
> directory (where my python program will eventually reside) and, on this
> local copy, comment out the version check. The idea is that MySQLdb is pure
> Python, so it's unlikely that there is any incompatibility between it and
> the very thin layer that is _mysql. The local copy is so I don't forget
> that I'm using a modified version of this library. Python seems to import
> this over the global one. I've done a bit of testing and, so far, it
> appears to work!
> What is my problem? A google search reveals that I'm not the only
> person with this problem but it also reveals that absolutely no one knows
> how to fix this. What are the chances that my fix will backfire? Thank
> you...
I guess the package maintainer messed up. If you'd install MySQLdb from
source, it won't happen I guess. So I'd contact the package maintainer.
Diez
More information about the Python-list
mailing list