Calling a program and read its stdout (UNIX)
thiele at muc.das-werk.de
Tue May 9 09:30:56 EDT 2000
I want to call a (shell-)command from a python program and read its
standart output. I also want to set the user and the enviroment before.
At first I did the following: I forked a new process and replaced it by
calling execv. But so I'm not able to read the stdout, because I cannot
stdout - fileobject.
(Changing these objects doesn't affect the standard I/O streams of
processes executed by
os.popen(), os.system() or the exec*() family of functions in the os
module.) (from py_doc)
And if I use os.popen() I can read the output, but I cannot set the user
and the enviroment because popen opens a new shell.
Is there someone who can help me?
More information about the Python-list