MySQLdb and Unicode

Achim Domma (Procoders) domma at procoders.net
Fri May 20 03:36:11 EDT 2005


Hi,

I try to write unicode strings to a MySQL database via MySQLdb. 
According to the documentation I should pass 'utf-8' as keyword 
parameter to the connect method. But then I get the following error:


Traceback (most recent call last):
   File "C:\develop\SyynX\unicode_test.py", line 7, in ?
     con=MySQLdb.connect(host='localhost',db='unicode_test',unicode='utf-8')
   File "C:\Python24\Lib\site-packages\MySQLdb\__init__.py", line 66, in 
Connect
     return Connection(*args, **kwargs)
   File "C:\Python24\Lib\site-packages\MySQLdb\connections.py", line 
134, in __init__
     super(Connection, self).__init__(*args, **kwargs2)
TypeError: 'unicode' is an invalid keyword argument for this function


I'm using version 1.2 of MySQLdb. Any hint what I'm doing wrong?

regards,
Achim



More information about the Python-list mailing list