1

I am developing a specific IDE for python in C++, using Python C API. I would like embed a python terminal in it.

I tried using PyRun_SimpleString, its works but it don't behave like a python terminal (for example, 1 + 1 don't show the answer). I am trying use PyRun_InteractiveOne, but I don't know how I can get the output of this method to C++ side.

Anyone have any tip about how can I get this values in C++ side? Is there some module or code for python script behave as interactive mode?

Thank you,

1 Answers1

0

Unfortunately PyRun_SimpleString() is too simple. If you want a result back then you need to use PyRun_String{,Flags}().

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
  • This question includes an example of how to call PyRun_String(): http://stackoverflow.com/questions/12518435/pyrun-string-stop-sending-result-to-stdout-after-any-error – Andrew Bainbridge Jan 10 '14 at 08:52