Non-exhaustive file reads
Fredrik Tolf
fredrik at dolda2000.com
Sat Dec 2 22:48:22 EST 2006
I just got shocked to find out the hard way that the read() method on
Python's file objects will, very much unlike the C read() function, read
until the given size is reached, which is quite a problem for me when
selecting a couple of pipes and wanting to just read the available data
from them.
The only hint I can find for avoiding this behavior is from
file.read.__doc__, which says that it doesn't do that in non-blocking
mode, but nowhere can I find any information about how to enable
non-blocking mode in Python.
Can anyone provide me with any information on how to accomplish this?
Regards,
Fredrik Tolf
More information about the Python-list
mailing list