[Tutor] Capturing stdout/stderror from linked c++ program

Douglas Eck doug@idsia.ch
Mon Mar 10 09:34:02 2003


Erik Wrote:
 >Will the os.popen() function do what you need?

Hi Erik,
Thanks for the reponse.  According to the documentation, no, popen() 
won't work. I'm calling a linked C++ object file that has python 
bindings, not a system command.

For example, here is a snippet of python that would init a net, run it, 
and then get activations. Notice that
no system calls are made at all... neuranet is not an executable. It's 
an object file with python bindings.


from dse import neuralnet     %my neural net python interface
neuralnet.init("params.txt")
neuralnet.run()                    %here is where the stdout stuff happens.
a=neuralnet.getActs()

So as I understand it popen() is set up to run a unix command, not 
something like "neuralnet" in the example here.  Or maybe I'm missing 
something?  I hope I am.

Thanks!
Doug