【发布时间】:2017-07-09 10:56:15
【问题描述】:
https://github.com/affinelayer/pix2pix-tensorflow/tree/master/tools
在上述站点编译“process.py”时出错。
python tools/process.py --input_dir data -- operation resize --outp
ut_dir data2/resize
data/0.jpg -> data2/resize/0.png
Traceback(最近一次通话最后一次):
File "tools/process.py", line 235, in <module>
main()
File "tools/process.py", line 167, in main
src = load(src_path)
File "tools/process.py", line 113, in load
contents = open(path).read()
File"/home/user/anaconda3/envs/tensorflow_2/lib/python3.5/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
错误的原因是什么? Python 的版本是 3.5.2。
【问题讨论】:
-
如果您想尝试修复错误文件而不是使用不同编码解析文件,请尝试在您尝试使用 python 代码处理的文件上运行
dos2unix。
标签: python python-3.x utf-8