[Tutor] How to get messages from stderr

Michael Janssen Janssen@rz.uni-frankfurt.de
Wed Jul 30 21:55:03 2003


On Thu, 31 Jul 2003, klappnase wrote:

> def runcmd(self):
> 	self.pp = popen2.Popen4(cmd)
> 	self.ppp = self.pp.fromchild
> 	self.frame.after(100, self.getprogress)
>
> def getprogress(self):
> 	self.progress = self.ppp.read()
> 	self.frame.after(100, self.getprogress)
>
> but I found that I only got any output after the child process had
> finished. It seems to work as long as I only get the output from
> stdout with Popen3, but I need the stderr messages. Does anyone know a
> way to get the output from stderr while the child process is still
> running? Any help would be very appreciated.

can't remember those popenX thing but perhaps you can redirect the output
to stdout (depends on what OS you use and if you don't need to keep the
streams seperate)?

os.popen("[command] 2>&1") is Linux-bash Syntax to redirect stderr to
stdout.

regards
Michael