Re: non-blocking IO EAGAIN on write

2010-07-27 Thread Lawrence D'Oliveiro
In message , Roy Smith wrote: > Consider, for example, a write on a TCP connection. You are sitting in > a select(), when the other side closes the connection. The select() > should return, and the write should then immediately fail. Remember that select can return 3 different sets of file obje

Re: non-blocking IO EAGAIN on write

2010-07-26 Thread Thomas Guettler
John Nagle wrote: > On 7/23/2010 1:45 AM, Thomas Guettler wrote: >> Hi, >> >> I use non-blocking io to check for timeouts. Sometimes I get EAGAIN >> (Resource temporarily unavailable) >> on write(). My working code looks like this. But I am unsure how many >>

Re: non-blocking IO EAGAIN on write

2010-07-24 Thread Kushal Kumaran
- Original message - > In article , >  Kushal Kumaran wrote: > > > In general, after select has told you a descriptor is ready, the > > first write after that should always succeed. > > > > Consider, for example, a write on a TCP connection.  You are sitting in > a select(), when the ot

Re: non-blocking IO EAGAIN on write

2010-07-24 Thread John Nagle
On 7/23/2010 1:45 AM, Thomas Guettler wrote: Hi, I use non-blocking io to check for timeouts. Sometimes I get EAGAIN (Resource temporarily unavailable) on write(). My working code looks like this. But I am unsure how many bytes have been written to the pipe if I get an EAGAIN IOError. At

Re: non-blocking IO EAGAIN on write

2010-07-24 Thread Roy Smith
In article , Kushal Kumaran wrote: > In general, after select has told you a descriptor is ready, the > first write after that should always succeed. I used to think that too. Over the last few years, I've been maintaining a large hunk of cross-platform C++ code which makes heavy use of sel

Re: non-blocking IO EAGAIN on write

2010-07-23 Thread Kushal Kumaran
On Fri, Jul 23, 2010 at 2:15 PM, Thomas Guettler wrote: > Hi, > > I use non-blocking io to check for timeouts. Sometimes I get EAGAIN (Resource > temporarily unavailable) > on write(). My working code looks like this. But I am unsure how many bytes > have been written to the

Re: non-blocking IO EAGAIN on write

2010-07-23 Thread Nobody
On Fri, 23 Jul 2010 10:45:32 +0200, Thomas Guettler wrote: > I use non-blocking io to check for timeouts. Sometimes I get EAGAIN > (Resource temporarily unavailable) on write(). My working code looks > like this. But I am unsure how many bytes have been written to the pipe > if I g

non-blocking IO EAGAIN on write

2010-07-23 Thread Thomas Guettler
Hi, I use non-blocking io to check for timeouts. Sometimes I get EAGAIN (Resource temporarily unavailable) on write(). My working code looks like this. But I am unsure how many bytes have been written to the pipe if I get an EAGAIN IOError. Up to now I retry with the same chunk. If I get

Re: Non-Blocking IO

2007-09-01 Thread Hendrik van Rooyen
"mp" wrote: > Calling try3() yields the error: > File "./test.py", line 54, in try3 > print os.read(fout.fileno(),256) > OSError: [Errno 35] Resource temporarily unavailable This means there is no data available- its actually working! - Hendrik -- http://mail.python.org/mailman/listin

Re: Non-Blocking IO

2007-08-31 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, mp wrote: > Calling try3() yields the error: > File "./test.py", line 54, in try3 > print os.read(fout.fileno(),256) > OSError: [Errno 35] Resource temporarily unavailable That's what's supposed to happen. That's telling you there are no bytes currently avail

Non-Blocking IO

2007-08-31 Thread mp
I'm trying to use popen2 to call a program and then write and read data from the program using a Python script. Unfortunately, my calls to read block (I need non-blocking IO), and all the workarounds I've seen online don't work. Here is my most promising solution and how it bre

Re: subprocess and non-blocking IO (again)

2005-10-11 Thread Thomas Bellman
Marc Carter <[EMAIL PROTECTED]> writes: > The problem with the above is that the subprocess buffers all its output > when used like this and, hence, this automation is not informing me of > much :) You may want to take a look at my asyncproc module. With it, you can start subprocesses and let

Re: subprocess and non-blocking IO (again)

2005-10-11 Thread Marc Carter
Donn Cave wrote: > If you want to use select(), don't use the fileobject > functions. Use os.read() to read data from the pipe's file > descriptor (p.stdout.fileno().) This is how you avoid the > buffering. Thankyou, this works perfectly. I figured it would be something simple. Marc -- http://m

Re: subprocess and non-blocking IO (again)

2005-10-11 Thread Nick Craig-Wood
Marc Carter <[EMAIL PROTECTED]> wrote: > import subprocess,select,sys > > speakers=[] > lProc=[] > > for machine in ['box1','box2','box3']: > p = subprocess.Popen( ('echo '+machine+';sleep 2;echo goodbye;sleep > 2;echo cruel;sleep 2;echo world'), stdout=subprocess.PIPE, > stderr=sub

Re: subprocess and non-blocking IO (again)

2005-10-10 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Marc Carter <[EMAIL PROTECTED]> wrote: > I am trying to rewrite a PERL automation which started a "monitoring" > application on many machines, via RSH, and then multiplexed their > collective outputs to stdout. > > In production there are lots of these subprocess

subprocess and non-blocking IO (again)

2005-10-10 Thread Marc Carter
I am trying to rewrite a PERL automation which started a "monitoring" application on many machines, via RSH, and then multiplexed their collective outputs to stdout. In production there are lots of these subprocesses but here is a simplified example what I have so far (python n00b alert!) - SNI