今天在搭建数据驱动测试框架的时候遇到这个错误:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 357: illegal multibyte sequence 错误解决方法(已解决)
好在我英语水平还不错(也就六级水平吧),根据英文提示说是多字节数据顺序是非法的
顺着错误往上找发现 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 错误解决方法(已解决)
将其中的with open(filename, encoding=encoding) as fp:

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

相关文章:

  • 2021-12-01
  • 2022-12-23
  • 2021-08-15
  • 2022-03-10
  • 2021-09-11
  • 2021-10-26
  • 2021-07-22
  • 2022-01-16
猜你喜欢
  • 2022-01-14
  • 2021-09-21
  • 2021-04-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
相关资源
相似解决方案