[Tutor] How to get messages from stderr

klappnase klappnase@freenet.de
Thu Jul 31 05:14:02 2003


On Thu, 31 Jul 2003 03:54:25 +0200 (CST)
Michael Janssen <Janssen@rz.uni-frankfurt.de> wrote:

> 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
> 

Thank you so much for the feedback.
Sorry, I forgot to mention that it is a linux box.
Unfortunately this does not seem to solve my problem, the messages only appear if "cmd" has finished.
The problem seems to be that the file object containing the data from stderr should be closed first
before I can read the data, but how is it possible then that further writing is done there?
Does anyone know help?

Thanks in advance

Michael