Capture output from stderr

Grant Edwards grante at
Wed Aug 6 02:30:13 CEST 2003

In article <a7a67196.0308051626.393446ea at>, klappnase wrote:

> I am trying to program a Tkinter application for linux, so I want to
> run a shell command from the gui and capture its output on the fly
> while the process is still running in order to display the progress
> messages in a toplevel window so the user may watch what is going on
> (the execution of the shell command may take a few minutes). Because
> the output is printed to stderr I thought I should use a popen2.Popen4
> instance for that, like:
>         self.pp = popen2.Popen4("exec cmd")
> I tried something like 
>     def getmsg(self):
>         msg = self.pp.fromchild
>         newmsg =
>         ...(do something)...
>         self.master.after(1000, self.getmsg)

I've always used a read handler for this in the past, and it worked fine.
I don't have an example handy...

Grant Edwards                   grante             Yow!  Like I always
                                  at               say -- nothing can beat
                                 the BRATWURST here in

More information about the Python-list mailing list