emulating python shell

Uwe Mayer merkosh at hadiko.de
Tue Dec 28 19:18:30 CET 2004


Hi,

in an application I want to provide direct access to the python interpreter
of the running program.
I use rawinput() and exec() to read an input string and a self-made function
to check wether the inputed block is closed and then execute it.

When running python interactively the result of the previous statement is
assigned to the variable "_" and commands like dir() just output their
results to stdout. 
However, executions of the sort:

exec("_ = "+command)

don't work.

Any ideas how to mimick python -i 's behaviour?

Thanks
Uwe 



More information about the Python-list mailing list