Bug #74345 | connector/python can't report errors that have non-ascii characters, as of 2.0 | ||
---|---|---|---|
Submitted: | 13 Oct 2014 0:31 | Modified: | 14 Nov 2014 14:49 |
Reporter: | Mike Bayer | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / Python | Severity: | S2 (Serious) |
Version: | 2.0.1 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[13 Oct 2014 0:31]
Mike Bayer
[13 Oct 2014 8:19]
MySQL Verification Team
Hello Mike Bayer, Thank you for the report and test case. Thanks, Umesh
[13 Oct 2014 8:19]
MySQL Verification Team
// [root@cluster-repo master]# rpm -qa|grep mysql-connector-python mysql-connector-python-commercial-2.0.1-1.el6.noarch [root@cluster-repo master]# python Python 2.6.6 (r266:84292, Jan 22 2014, 01:49:05) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> >>> from mysql import connector character = u'\u6e2c\u8a66' conn = connector.connect( user='root', password='', host='localhost', database='test') >>> character = u'\u6e2c\u8a66' >>> >>> conn = connector.connect( ... user='root', password='', host='localhost', database='test') >>> >>> cursor = conn.cursor() >>> sql = u"create table %s (id integer)" % character >>> >>> for i in range(2): ... try: ... cursor.execute(sql) ... except connector.ProgrammingError as exc: ... print(exc) ... break ... Traceback (most recent call last): File "<stdin>", line 3, in <module> File "/mysql/connector/cursor.py", line 507, in execute File "/mysql/connector/connection.py", line 720, in cmd_query File "/mysql/connector/connection.py", line 638, in _handle_result File "/mysql/connector/errors.py", line 165, in get_exception File "/mysql/connector/errors.py", line 130, in get_mysql_exception File "/mysql/connector/errors.py", line 197, in __init__ UnicodeEncodeError: 'ascii' codec can't encode characters in position 7-8: ordinal not in range(128)
[14 Nov 2014 14:49]
Paul DuBois
Noted in 2.0.3, 2.1.2 changelogs. Error messages containing non-ASCII characters caused an exception to be raised.