MySQLdb for Python 2.5

H

Harold Trammel

Hi everyone,

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
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Harold said:
Does anyone know the status of a version of MySQLdb that will work with
Python 2.5?

AFAICT, MySQLdb 1.2.1 builds and works just fine.

Regards,
Martin
 
J

James Stroud

Harold said:
Hi everyone,

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

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
 
F

FatherAntox

Martin said:
AFAICT, MySQLdb 1.2.1 builds and works just fine.

Regards,
Martin

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
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

FatherAntox said:
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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,218
Latest member
JolieDenha

Latest Threads

Top