UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 357: illegal multibyte sequence 错误解决方法(已解决)

今天在搭建数据驱动测试框架的时候遇到这个错误:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 357: illegal multibyte sequence 错误解决方法(已解决)_第1张图片
好在我英语水平还不错(也就六级水平吧),根据英文提示说是多字节数据顺序是非法的
顺着错误往上找发现 File "C:\Users\Mr雷的电脑\AppData\Local\Programs\Python\Python37\lib\configparser.py", line 696, in read
self._read(fp, filename)
这意思是这个文件的地696行的一个函数,,应该是编码的问题,点进去一看
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 357: illegal multibyte sequence 错误解决方法(已解决)_第2张图片
将其中的with open(filename, encoding=encoding) as fp:

解决方案:
with open(filename, encoding=encoding) as fp: 改为
with open(filename, encoding=‘UTF-8’) as fp:即可

你可能感兴趣的:(UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 357: illegal multibyte sequence 错误解决方法(已解决))