我试图下载BVLC训练模式,我坚持了这个错误“UTF-8”编解码器不能解码字节0x80的
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 110: invalid start byte
我想这是因为以下功能(complete code )
# Closure-d function for checking SHA1.
def model_checks_out(filename=model_filename, sha1=frontmatter['sha1']):
with open(filename, 'r') as f:
return hashlib.sha1(f.read()).hexdigest() == sha1
任何想法如何解决这个问题?
错误消息是很清楚。您的文件根本不是UTF8,或者它已损坏。 – usr2564301
这就是当我尝试打印'f' '<_io.TextIOWrapper name ='models/bvlc_reference_caffenet/bvlc_reference_caffenet时得到的结果。caffemodel'mode ='r'encoding ='utf8'>' –
有趣。那么当你明确指定文件编码时会发生什么?像'open(filename,'r',encoding ='utf8')''? –