当前位置: 代码迷 >> 综合 >> web.py TypeError: memoryview: a bytes-like object is required, not 'str' .txt
  详细解决方案

web.py TypeError: memoryview: a bytes-like object is required, not 'str' .txt

热度:95   发布时间:2024-01-25 20:37:34.0
1.报错详情:
Traceback (most recent call last):File "D:\Program Files\python36\lib\base64.py", line 517, in _input_type_checkm = memoryview(s)
TypeError: memoryview: a bytes-like object is required, not 'str'2.解决方案:
D:\Program Files\python36\lib\base64.py文件,line 517。
def _input_type_check(s):try:m = memoryview(s)except TypeError as err:替换为:
def _input_type_check(s):try:if type(s) == str:s = s.encode()m = memoryview(s)except TypeError as err:搞定!
  相关解决方案