[ python-Bugs-875157 ] file.read returns reaches EOF when it shouldn't

SourceForge.net noreply at sourceforge.net
Wed Jun 1 14:17:31 CEST 2005


Bugs item #875157, was opened at 2004-01-11 23:37
Message generated for change (Settings changed) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=875157&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.2.3
>Status: Closed
>Resolution: Works For Me
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: Reinhold Birkenfeld (birkenfeld)
Date: 2005-06-01 14:17

Message:
Logged In: YES 
user_id=1188172

I think this can be closed due to lack of response.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2004-01-12 00:57

Message:
Logged In: YES 
user_id=31435

turingcomplete, please say which version of Python you're 
using, which operating system, and show the actual code you 
use to open the file and read from it.  Else this one is just too 
hard to believe -- if there were a general problem like this, it 
would have been reported many times.

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2004-01-11 23: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