non blocking read()

Steve Holden steve at holdenweb.com
Thu Dec 2 10:38:45 EST 2004


Gustavo Córdova Avila wrote:

> Donn Cave wrote:
> 
>>
>> Depends.  I don't believe the original post mentioned
>> that the file is a pipe, socket or similar, but it's
>> kind of implied by the use of select() also mentioned.
>> It's also kind of implied by use of the term "block" -
>> disk files don't block.
>>
>> If we are indeed talking about a pipe or something that
>> really can block, and you call fileobject.read(1024),
>> it will block until it gets 1024 bytes.
>>
>>   Donn Cave, donn at u.washington.edu
>>
> Actually the op did mention that he wanted to monitor files.

As was pointed out to me when I made the same assertion, he actually 
said "file object which is stdin" or something like that, which means 
the object could be a socket, a pipe, a file, a named pipe ...

regards
  Steve
-- 
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119



More information about the Python-list mailing list