Embedding? file_input and eval_input

James Spears jimsp at ichips.intel.com
Fri Aug 11 13:45:40 EDT 2000


Ok, first off I checked dejanews, and the Python FAQTS, no luck....

I am embedding Python in a tool and would like the user to be able to
issue Python command and evaluate expressions. PyRun_String expects
single_input, file_input or eval_input as an starting production in the
grammar, this is fine except that I would like to be able to run an
arbitrary user supplied command and get the PyObject return value for
expressions or PyNone if it was a statement.

here is the problem:

PyRun_String with a statement and single_input returns PyNone
PyRun_String with a expression and single_input *PRINTS the result* and
returns PyNone

PyRun_String with a statement and file_input returns PyNone
PyRun_String with a expression and file_input returns PyNone

PyRun_String with a statement and eval_input returns NULL indicating an
error.
PyRun_String with a expression and eval_input returns PyObject* with the
expected value.

--James.




More information about the Python-list mailing list