Author rmalouf
Recipients ezio.melotti, rmalouf, vstinner
Date 2020-04-28.04:33:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Calling TextIOWrapper.tell() while reading the attached gb2312-encoded file like this:

with open('udhr-gb2312.txt', encoding='GB2312') as f: 
    while True: 
       line = f.readline() 
       t = f.tell()
       if not line: 

gives this result:

Traceback (most recent call last):
  File "", line 4, in <module>
    t = f.tell()
UnicodeDecodeError: 'gb2312' codec can't decode byte 0xb5 in position 0: illegal multibyte sequence

The file seems to be well-formed and can be read without any problem.  It's only the call to tell() that raises an issue.
Date User Action Args
2020-04-28 04:33:56rmaloufsetrecipients: + rmalouf, vstinner, ezio.melotti
2020-04-28 04:33:56rmaloufsetmessageid: <>
2020-04-28 04:33:56rmalouflinkissue40416 messages
2020-04-28 04:33:56rmaloufcreate