错误如下:
Traceback (most recent call last):
File "D:/Codes/python/1023/jinpin.py", line 16, in
result = aipOcr.general(get_file_content('imgcode.inc.png'))
File "C:\Program Files\Python35\lib\site-packages\baidu_aip-1.6.2.0-py3.5.egg\aip\ocr.py", line 81, in general
File "C:\Program Files\Python35\lib\site-packages\baidu_aip-1.6.2.0-py3.5.egg\aip\base.py", line 79, in _request
File "C:\Program Files\Python35\lib\site-packages\baidu_aip-1.6.2.0-py3.5.egg\aip\ocr.py", line 159, in _validate
File "C:\Program Files\Python35\lib\re.py", line 163, in match
return _compile(pattern, flags).match(string)
TypeError: cannot use a string pattern on a bytes-like object
代码如下:
def get_file_content(filePath):
with open(filePath, 'rb') as fp:
return fp.read()
# get_file_content("zheye.png")
aipOcr = AipOcr(APP_ID, API_KEY, SECRET_KEY)
result = aipOcr.general(get_file_content('imgcode.inc.png'))
收藏
点赞
0
个赞
请登录后评论
TOP
切换版块
您看看是不是IDE的问题?重新创建一个项目试试