Does anyone know the status of a version of MySQLdb that will work with
Python 2.5? I will accept a workaround if you know one. Thanks in advance.
Harold Trammel
AFAICT, MySQLdb 1.2.1 builds and works just fine.
Regards,
Martin
I could not find a way around this requirement, but you will want to
manually add libz to your building with this version. This seems to be
how to do this when you run setup.py:
python setup.py -lz [other args] install
This is for mysqldb "MySQL-python-1.2.1_p2" (which I believe is the
latest).
I built this a few days ago and finally tested today and got this
terribly annoying (and apparently well documented) error:
[stacktrace clipped]
LookupError: unknown encoding: latin1_swedish_ci
My setup: python 2.5, very old mysql servers (C. 2003?), mysqldb
1.2.1_p2. It seems the problem is related to mysqldb, but I'm not sure.
I found the only real work-around here:
http://mail.python.org/pipermail/python-list/2006-July/350408.html
Its ugliness manifests in my code as such:
#######################################################################
# workaround function for problems with encoding
#######################################################################
def _csn(*args, **kwargs): return 'utf-8'
#######################################################################
# init_mysql()
#######################################################################
def init_mysql(the_db="some_db"):
adb = MySQLdb.connect(
host="sql.some.institute.edu",
# charset="utf8", # <-- our mysql servers too old for this
user="my_login",
passwd="pa55w0rd",
db=the_db
)
adb.character_set_name = instancemethod(_csn, adb, adb.__class__)
return adb
This fix passes some initial rudimentary tests. No guarantees on proper
handling of unicode. If you are using unicode, you may want to test it
thoroughly with this fix and report your results (preferably on this
comp.lang.python).
James
Does anyone know if Windows binaries for 2.5 are available somewhere?
Regards,
Jan
Hi Martin,
What is your setup as I am receiving a number of "Cannot open ..."
errors related to various msysql libraries and includes? I am running
in a Windows XP environment with MySQL 5.1. Thanks in advance.
Harold
I have been using Debian unstable. As I said, it built out of the box
(I actually built the Debian source package, adding 2.5 to the list
of target versions).
Regards,
Martin