Archive for November, 2008

Executing an external program in Python…

Wednesday, November 19th, 2008

There are several ways of executing an external program from Python, but I had
the problem to catch the standard output.

After a while I came to the following solution:

import os

# Executing a shell command
mycmd = "python"
child_stdin, child_stdout, child_stderr = os.popen3(mycmd)

# Reading the output streams
my_output =
my_error =

print "my_output:", my_output
print "my_error:", my_error


Roberto Rocco Angeloni is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

Fatal error: Cannot access protected property ObjectMgr::$_verbose in /web/htdocs/ on line 22