embedding Python in Python
Kasper Souren
Kasper.Souren at ircam.fr
Mon Mar 3 21:32:59 EST 2003
Hi,
Maybe this has been done or asked before, but with Google I couldn't find
anything about it.
I want to make an interface from TeXmacs to Python (and later IPython). I
translated the C++ example (mycas.cc) into mycas.py and it works fine. But
now I want to embed (..or call it what you like..) a Python interpreter in
mycas.py.
Thus I would like to be able to write something like:
py_interpreter_instance = Python_Embedded_Interpreter()
output_string = py_interpreter_instance.execute(command_string)
or
py_stdout, py_stderr = py_interpreter instance.execute(command_string)
I took a look at IPython's code, which implements something similar. It works
by trapping the stdout and stderr, but I hope that there is a nicer way to
do this...
I wouldn't mind writing the Python_Embedded_Interpreter class myself. I played
with the idea of simply using eval() but eval("print") doesn't even work as
expected.
bye,
Kasper
More information about the Python-list
mailing list