python - Error Keyerror 255 when executing pymysql.connect -
here code
import pymysql pymysql.connect( host='localhost', port=3306, user='root', password='idontwannasay', db='idontwannashow', charset='utf8' )
and error traceback was:
data :::::b'\xff\x02\x00\xff\x81\x15'....##### add near line 1279 print("data :::::%s...."%data[i:i+6]) traceback (most recent call last): file "c:\users\123\desktop\pymysqldebug.py", line 8, in <module> charset='utf8' file "d:\program files (x86)\python\python35\lib\site-packages\pymysql\__init__.py", line 90, in connect return connection(*args, **kwargs) file "d:\program files (x86)\python\python35\lib\site-packages\pymysql\connections.py", line 709, in __init__ self.connect() file "d:\program files (x86)\python\python35\lib\site-packages\pymysql\connections.py", line 934, in connect self._get_server_information() file "d:\program files (x86)\python\python35\lib\site-packages\pymysql\connections.py", line 1279, in _get_server_information self.server_charset = charset_by_id(lang).name file "d:\program files (x86)\python\python35\lib\site-packages\pymysql\charset.py", line 39, in by_id return self._by_id[id] keyerror: 255
seems struct.unpack method parse '\xff\' 255 , assigned self.server_language
, whatever non-null charset argument passed.
is mysql version problem?(version 8.0.1-dmr
)
the problem can referred pull request 591
Comments
Post a Comment