How to get number of bytes written to nonblocking FIFO when EAGAIN is raised?
roy at panix.com
Tue Jul 19 22:26:39 EDT 2011
<40996f2a-4ed8-4388-ae1a-6f81f57a4526 at f17g2000prf.googlegroups.com>,
Aaron Staley <usaar33 at gmail.com> wrote:
> Scenario. I have a fifo named 'fifo' on my computer (ubuntu linux)
> operating in nonblocking mode for both read and write. Under normal
> operation all is good:
> Interpreter 1 (writer)
> >>> import os
> >>> fd = os.open('fifo', os.O_WRONLY | os.O_NONBLOCK)
> >>> f = os.fdopen(fd,'wb')
> Unfortunately, the IOError seems to have no attribute indicating how
> much data was successfully sent. I've looked through the docs and
> can't seem to figure out how; can anyone land some advice?
I'm thinking you want to skip the os.fdopen() call and use the file
descriptor directly, with os.write(). I've never used this, but it
seems like what you probably want to try.
More information about the Python-list