Hvass-Labs / TensorFlow-Tutorials

TensorFlow Tutorials with YouTube Videos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tutorial 20: UTF-8 decoding necessary for readLines to work

opened this issue · comments

Python will complain about a character being out of range.

I was able to fix it locally by adding encoding='utf8' to the open file call, line 57 in imdb.py.

Please give more details. What are the original code-lines and the error you got, and what is your revised code-line.

I got the running error in Windows 10:
UnicodeDecodeError: 'cp950' codec can't decode byte 0xc2 in position 399: illegal multibyte sequence.

I revised the code-line, on line 57 in imdb.py, with,
with open(path, 'rt', encoding='utf-8') as file:,
and then, it ran completely.

now it works fine with<<< open(path, 'rt', encoding='utf-8') as file: >>> on line 57 @imdb.py

Thanks to you all for reporting this. I did not get this error on my system, so it is helpful to have several people report and confirm it. I have now updated that code-line.