Catching subprocess stdout stream

Michele Simionato michele.simionato at gmail.com
Wed Sep 10 08:21:00 EDT 2008


On Sep 8, 5:37 pm, Thomas Jansson <tjansso... at gmail.com> wrote:
> Dear all
>
> I have tkinkter based frontend to a Fortran based program. I use
> subprocess to launch the fortran program as a child process and I wish
> to see the output of the fortran program as it is created in the
> console.
>
> The fortran program can take up to 20 minuttes to finish and at the
> moment the I will first see any output after the fortran program is
> done. How make my function write the output of the process as it
> comes?

Sometimes very low technology solutions may be enough. For instance on
Unix
you could call os.system on something like that:

xterm -e "the-fortran-executable|less"

Make sure the Fortran executable output is unbuffered.

              Michele Simionato



More information about the Python-list mailing list