[issue1735418] file.read() truncating strings under Windows
Antoine Pitrou
report at bugs.python.org
Mon Apr 6 12:24:39 CEST 2009
Antoine Pitrou <pitrou at free.fr> added the comment:
It's a bug in the program's logic. The program assumes that the file
pointer will have advanced by the same number of bytes as were returned
by read(), but it is false when opened in text mode ('r') since text
mode under Windows will convert Windows newlines ('\r\n') into C
newlines ('\n').
Also, please note this is a feature of Windows itself, *not* of Python.
That's why you don't see it happening on e.g. Mac OS X.
And that's why the fix, short of changing the program's logic, is to
open in binary mode ('rb').
----------
resolution: -> invalid
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1735418>
_______________________________________
More information about the Python-bugs-list
mailing list