how to get the output of embedded python?

Jean-Luc Fontaine jfontain at winealley.com
Tue Feb 13 06:51:50 EST 2001


I am trying to write a tclpython extension so that modules for my system 
monitoring application (moodss at http://jfontain.free.fr/moodss11.htm) can 
also be written in python, on top of tcl and perl.

It has been quite simple to write the tclperl extension, since perl allows 
retrieving the result in string form of any script, using the internal eval 
facilities.

With python, according to my research on the subject (which may be wrong 
since I am new in python), there does not seem to be any simple way to 
gather the output of a script passed for example to PyRun_SimpleString. I 
also looked at the huge piece of code that handles the interactive part of 
python so that typing 1+1 at the prompt prints 2.

Did I miss something in the C API and is there an implementation of say:

char *PyEval(char *script)

somewhere?

Additionally, I would also need the above functionality on a per 
interpreter basis (I need to be able to use several interpreters 
concurrently).

My apologies if the questions above seem trivial.

-- 
Jean-Luc Fontaine mailto:jfontain at winealley.com http://www.winealley.com




More information about the Python-list mailing list