By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,627 Members | 1,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,627 IT Pros & Developers. It's quick & easy.

MySQLdb for Python 2.5

P: n/a
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
Sep 30 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Harold Trammel schrieb:
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
Sep 30 '06 #2

P: n/a
Harold Trammel wrote:
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/pyt...ly/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

Sep 30 '06 #3

P: n/a
Martin v. Lwis wrote:
Harold Trammel schrieb:
>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.
Does anyone know if Windows binaries for 2.5 are available somewhere?

Regards,
Jan

Sep 30 '06 #4

P: n/a

Martin v. Lwis wrote:
Harold Trammel schrieb:
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
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

Oct 5 '06 #5

P: n/a
FatherAntox schrieb:
>AFAICT, MySQLdb 1.2.1 builds and works just fine.

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
Oct 5 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.