programme call with popen
jeff at ccvcorp.com
Wed Aug 29 20:59:20 CEST 2001
Marcin 'Qrczak' Kowalczyk wrote:
> Wed, 29 Aug 2001 10:24:03 -0700, Jeff Shannon <jeff at ccvcorp.com> pisze:
> >>>> myoutput = fout.read()
> > Note that this will block until the program has finished running.
> I'm not sure about Windows, but it won't block that long on Unix.
> Both processes will run in parallel exchanging data. The consumer
> will temporarily block when the queue is empty and the producer will
> block when the queue's buffer is full.
Hm, I'm not positive about this as I haven't tested it, but I was under the
impression that since read(), with no arguments, reads the entire file
until EOF, that it would not return until EOF was reached, i.e., the piped
program terminates. It is definately true that if one uses readline(), or
read(blocksize), that both programs will run in parallel. My own (rare)
uses of popen have involved using read(blocksize)-type constructs only...
More information about the Python-list