Hvass-Labs / TensorFlow-Tutorials

TensorFlow Tutorials with YouTube Videos
MIT License
9.28k stars 4.19k forks source link

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

Closed ghost closed 5 years ago

ghost commented 5 years ago

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.

Hvass-Labs commented 5 years ago

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

vikingee commented 5 years ago

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.

bharath5673 commented 5 years ago

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

Hvass-Labs commented 5 years ago

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.