I don't understand popen2 :(

marco at atmosp.physics.utoronto.ca marco at atmosp.physics.utoronto.ca
Fri Feb 16 00:23:26 EST 2001


In article <t8m0p6j29c9ia3 at corp.supernews.com>, Penfold <spam at spam.com>
writes:
>This is simply the usual nightmare of dealing with pipes between processes.
[snip]

Thanks for the explanation, I suspected something along those lines...

>Solution ... I tend to alter the pipes to no longer be blocking ... I'm not
>sure what other people do in these cases.  You
>can use fctl to do this but I forget the flags you want, something like
>NDELAY and O_NOBLOCK ... I have none of
>my sample code to hand.  Look at man fcntl.

Good tip! I've started looking into this, but if anyone has some
examples it would be a great help (I would assume people run into
these problems all the time? Unfortunately my Python books -- the
O'Reilly ones -- make nary a mention of fcntl.)

>Alternatively, just read the pipes in a sensible order :-)

Well, I tried to do that, and I think I got it working.
However, it doesn't seem to be completely reliable, i.e.
I have to run popen2.popen3 many times and once in a while
it will get stuck, even if the order is right 99% of the time :(

Thanks for your help!

 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse at newsone.net



More information about the Python-list mailing list