On Tue, Jul 13, 2004 at 10:06:05PM +0200, Otto Wyss wrote:
| I want to start a process in my app and capture its output and error
| messages. Therefore I played a little with the exec sample under Windows
| but I wasn't able to capture any process output, the window of the exec
| sample always stayed empty. I.e. I just called a process which prints
| its help.
If you are using Windows then you will be better off asking on a
Windows forum.  This is a Debian (Linux) forum.
| Does anyone have an idea what I made wrong.
http://www.catb.org/~esr/faqs/smart-questions.html
First you need to show what you did (the code) and tell exactly what
environment you tried to run it in.
| Could anyone point me to other sample code for calling a process and
| capture its outputs, errors?
----- example.py
#!/usr/bin/python
import os
# open the pipe
stdin, stdout = os.popen2('/bin/echo hello world')
# read all of the output into memory
data = stdout.read()
# report on the result
print "The program printed:"
print data
-----
This works.  I even tested it!  :-)
-D
-- 
A)bort, R)etry, D)o it right this time
 
www: http://dman13.dyndns.org/~dman/            jabber: dman@dman13.dyndns.org
Attachment:
signature.asc
Description: Digital signature