读取图片代码:
with open('/Users/jason/temp/iris1.bmp', 'r') as f1:
matchReq['leftEyeImage'] = f1.read()
程序报错: ‘utf-8’ codec can’t decode byte 0xb4
几经折腾才想起来,图片文件不能以“字符”的方式来读取,要用“字符”读取,将‘r’改成‘rb’即可!
读取图片代码:
with open('/Users/jason/temp/iris1.bmp', 'r') as f1:
matchReq['leftEyeImage'] = f1.read()
程序报错: ‘utf-8’ codec can’t decode byte 0xb4
几经折腾才想起来,图片文件不能以“字符”的方式来读取,要用“字符”读取,将‘r’改成‘rb’即可!