popen question
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Tue Jan 8 04:38:50 EST 2008
On Tue, 08 Jan 2008 09:20:16 +0000, Robert Latest wrote:
> The program "slow" just writes the numbers 0 through 9 on stdout, one line a
> second, and then quits.
>
> I would have expected the python program to spit out a numbers one by one,
> instead I see nothing for 10 seconds and then the whole output all at once.
>
> How can I get and process the pipe's output at the pace it is generated?
Both processes have to make their communication ends unbuffered or line
buffered. See the documentation of `os.popen()` for the `bufsize`
argument. And do whatever is needed to output the numbers from ``slow``
unbuffered or line buffered.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list