how do I know when popen() finishes?

bragib at my-deja.com bragib at my-deja.com
Wed Oct 11 08:50:43 EDT 2000


John:

Typically I read from popen like this:
proc = os.popen( 'busyprogram' )
while 1:
    line = proc.readline()
    if line:
        print line
    else:
        break

Bragi

Note that popen is only for UNIX platforms.


In article <8s0gts$767$1 at nnrp1.deja.com>,
  jschmitt at vmlabs.com wrote:
> I'm using Python 2.0b2 on Wind2000.
>
> If I do something like
>
> import os
> f = os.popen( 'busyprogram' )
>
> how do I retrieve all the output that busyprogram produces when
> busyprogram finishes?  Do I busy wait on f.read(), ie, wait for end of
> file?  Does f.close() do the same thing as pclose(f)?
>
> Thanks.
>
> John
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list