Message315842
I've modified a little your example and it's clearly that the readline moves the cursor.
```
from __future__ import print_function
import codecs
import io
def run(stream):
offset = stream.tell()
try:
stream.seek(0)
header_row = stream.readline()
finally:
stream.seek(offset)
print(offset)
print(stream.tell())
print('Got header: %r' % header_row)
if stream.tell() == 0:
print(stream.tell())
print(stream.readline())
print('Skipping the header: %r' % stream.readline())
for index, line in enumerate(stream, start=2):
print('Line %d: %r' % (index, line))
b = io.BytesIO(u'ab\r\ncd\ndef\n'.encode('utf-16-le'))
s = codecs.EncodedFile(b, 'utf-8', 'utf-16-le')
run(s)
```
The first call to readline returns cd instead of ab. |
|
Date |
User |
Action |
Args |
2018-04-27 13:53:51 | Elena.Oat | set | recipients:
+ Elena.Oat, da |
2018-04-27 13:53:51 | Elena.Oat | set | messageid: <1524837231.94.0.682650639539.issue33361@psf.upfronthosting.co.za> |
2018-04-27 13:53:51 | Elena.Oat | link | issue33361 messages |
2018-04-27 13:53:51 | Elena.Oat | create | |
|