[ python-Bugs-875157 ] file.read returns reaches EOF when it
shouldn't
SourceForge.net
noreply at sourceforge.net
Sun Jan 11 17:50:46 EST 2004
Bugs item #875157, was opened at 2004-01-11 17:37
Message generated for change (Comment added) made by rhettinger
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=875157&group_id=5470
Category: Python Library
Group: Python 2.2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Joshua Allen (turingcomplete)
Assigned to: Nobody/Anonymous (nobody)
Summary: file.read returns reaches EOF when it shouldn't
Initial Comment:
If the first byte of a file is 0xFF file.read(size)
will return an empty string. Problem found while
trying to process binary file produced by another system.
----------------------------------------------------------------------
>Comment By: Raymond Hettinger (rhettinger)
Date: 2004-01-11 17:50
Message:
Logged In: YES
user_id=80475
I tried it an Py2.2.3, Py2.3.3, and Py2.4a0 and it works
fine. Perhaps you have some other problem.
>>> f = open('/pydev/hello.bin', 'rb')
>>> f.read(6)
'\xffhello'
The docstring for file.read does warn that sometimes fewer
bytes than requested can be returned in a non-blocking mode.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=875157&group_id=5470
More information about the Python-bugs-list
mailing list