gpt4 book ai didi

python-3.x - pymysql 停止工作 : NameError: name 'byte2int' is not defined

转载 作者:行者123 更新时间:2023-12-04 04:20:26 25 4
gpt4 key购买 nike

我在 Python 中使用 pymysql 连接到数据库。它工作正常,但现在我开始关注 error :

回溯(最近一次通话):

  File "/Users/njethani/Desktop/venv/lib/python3.6/site-packages/pymysql/__init__.py", line 94, in Connect
return Connection(*args, **kwargs)
File "/Users/njethani/Desktop/venv/lib/python3.6/site-packages/pymysql/connections.py", line 327, in __init__
self.connect()
File "/Users/njethani/Desktop/venv/lib/python3.6/site-packages/pymysql/connections.py", line 598, in connect
self._request_authentication()
File "/Users/njethani/Desktop/venv/lib/python3.6/site-packages/pymysql/connections.py", line 865, in _request_authentication
data = _auth.scramble_old_password(self.password, self.salt) + b'\0'
File "/Users/njethani/Desktop/venv/lib/python3.6/site-packages/pymysql/_auth.py", line 72, in scramble_old_password
hash_pass = _hash_password_323(password)
File "/Users/njethani/Desktop/venv/lib/python3.6/site-packages/pymysql/_auth.py", line 97, in _hash_password_323
for c in [byte2int(x) for x in password if x not in (' ', '\t', 32, 9)]:
File "/Users/njethani/Desktop/venv/lib/python3.6/site-packages/pymysql/_auth.py", line 97, in <listcomp>
for c in [byte2int(x) for x in password if x not in (' ', '\t', 32, 9)]:
NameError: name 'byte2int' is not defined

我使用以下几行连接到我的数据库(连接字符串):
conn = pymysql.Connect(host='hostname', port=3306, user='username', passwd='password', db='mysql')

最佳答案

由于 pymysql 维护者 refuses to release the fix ,解决方案只是安装旧版本的软件包:

pip3 install --user 'pymysql<0.9'

关于python-3.x - pymysql 停止工作 : NameError: name 'byte2int' is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51565646/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com