how to get the output of embedded python?

Jürgen Hermann jh at web.de
Thu Feb 15 23:00:29 CET 2001


"Jean-Luc Fontaine" <jfontain at winealley.com> schrieb im Newsbeitrag
news:96b6o6$a6e$1 at s1.read.news.oleane.net...
> Did I miss something in the C API and is there an implementation of say:
>
> char *PyEval(char *script)
>
> somewhere?

BTW, the easiest way to handle it is to create a cStringIO object,
PySys_SetItem() that as your stdout and then start your script. After it did
run, you can getvalue() the output.

This is much easier than writing your own file-like C extension.





More information about the Python-list mailing list