file.tell() -- obscure IOError

Uwe Mayer merkosh at
Fri Jun 14 23:17:25 EDT 2002

In article <MPG.1774c753f4d1f6fe989687 at>, 
merkosh at says...

now I did it. I isolated a piece of code which produces the same error 
in the command line:

>>> f = file('test.riff.txt')
>>> f.tell()
>>> while f.tell() < 109L:
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: (0, 'Error')

test.riff.txt contains the following:
//dies ist ein beispielkommentar

hier nichtmehr\r
hier auch nicht //hier schon

und hier ist schluss

<--- some time later: 5:17 o'clock in the morning --->

i ound the mistake. 
that is: i know what went wrong, but i still don't know why:
f was opened in text mode. calling 
f = file('test.riff.txt','rb')

works fine.
assumingly read() took \r and the new line characters as control 
characters... grml...


More information about the Python-list mailing list