peter_ammon at rocketmail.com
Tue Nov 16 01:08:00 CET 2004
I would like to read from a pipe in which data may arrive slowly. From
experimenting, it looks like os.read() will block until it returns the
maximum amount of data you asked for, in the second parameter to read(),
or until it hits EOF. I cannot find a way to return only the data that
the file object has immediately available.
If no data is available, blocking is OK.
The only workaround I can think of is to call select() in a loop,
reading and storing one byte each time, and then returning them when
select() indicates that the pipe is not ready for reading.
Are there better approaches? Thanks,
More information about the Python-list