UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0x80 in position 3131: invalid start byte
It doesn’t help that you have sys.setdefaultencoding(‘utf-8′), which is confusing things further – It’s a nasty hack and you need to remove it from your code. See https://stackoverflow.com/a/34378962/1554386 for more information The error is happening because line is a string and you’re calling encode(). encode() only makes sense if the string is a Unicode, so Python tries to convert it Unicode first using … Read more