[mod_python] MySQLdb problem

Joshua Ginsberg listspam at flowtheory.net
Sat May 6 16:17:27 EDT 2006


This is an issue related to MySQLdb, not mod_python.

-jag

On May 6, 2006, at 12:35 PM, yjfuk wrote:

> I am use mod_python3.2.8,MySQL-python-1.2.1_p2,mysql5.0.20,centOS
> when I run the script below(I save this script also in utf-8):
> #coding: utf-8
> from MySQLdb import connect
> connection=connect(user='root',passwd='',host='localhost',db='test')
> cursor = connection.cursor()
> cursor.execute("INSERT INTO `fee` ( `affair` ) VALUES ('~{2bJT~}')")
> #'~{2bJT~}' is a chinese word means test
>  
> it raise error:
> Traceback (most recent call last):
>   File "test.py", line 8, in ?
>     cursor.execute("INSERT INTO `fee` ( `affair` ) VALUES ('~{2bJT~}')")
>   File "/opt/python/lib/python2.4/site-packages/MySQLdb/cursors.py", 
> line 146, in execute
>     query = query.encode(charset)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 
> 40: ordinal not in range(128)
>  
>  
>  
>  
>
>
>
>
>
>
>
> ~{Dc~} ~{2;~} ~{Ok~} ~{JT~} ~{JT~} ~{=q~} ~{OD~} ~{Wn~} ~{!0?a!1~} ~{5D~} ~{SJ~} ~{Od~} ~{Bp~} ~{#?~}
> ~{TL~} ~{:-~} ~{VP~} ~{;*~} ~{4+~} ~{M3~} ~{ND~} ~{;/~} ~{SZ~} ~{J@~} ~{=g~} ~{R;~} ~{Aw~} ~{?F~} ~{<<~} ~{V.~} ~{VP#,44~} ~{PB~} Ajax ~{<<~} ~{Ju#,~}126 ~{!0~}D ~{<F~} ~{;.!1;p~} ~{HH~} ~{Le~} ~{Qi~} ~{VP~} ~{#!~} 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 6098 bytes
Desc: not available
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060506/b4360bae/attachment.bin


More information about the Mod_python mailing list