
Hello,
I embedded Python in an application to play with some objects. I want to add some features to my console and I don't find how to evaluate in the same way the Python console does.
I want to let the user insert a: for a in [1,2,3]:
and I want to put the '...' like the console but if I evaluate the 'for a in [1,2,3]:\n' using PyRun_SimpleString I get an error:
File "<string>", line 1 for a in [1,2,3]: ^ SyntaxError: unexpected EOF while parsing
Is there any way to evaluate in the same way the console does?
Thanks in advance, Pablo Yabo

On Tue, May 27, 2008 at 12:52 PM, Pablo Yabo <pablo.yabo@gmail.com> wrote:
I don't think you'll be able to get that type of behavior out of PyRun_SimpleString(). Try taking a look at the PyRun_Interactive*() functions and PyRun_String() with the Py_single_input start symbol. That should get you pointed in the right direction.
-- Jon Parise (jon of indelible.org) :: "Scientia potentia est"

On Tue, May 27, 2008 at 12:52 PM, Pablo Yabo <pablo.yabo@gmail.com> wrote:
I don't think you'll be able to get that type of behavior out of PyRun_SimpleString(). Try taking a look at the PyRun_Interactive*() functions and PyRun_String() with the Py_single_input start symbol. That should get you pointed in the right direction.
-- Jon Parise (jon of indelible.org) :: "Scientia potentia est"
participants (2)
-
Jon Parise
-
Pablo Yabo