embedded python question

Alex Martelli aleax at aleax.it
Wed Jul 24 08:19:08 EDT 2002


Keith S. wrote:

> I am writing a small application that has a command line
> for entering Python commands, and a message window to show
> the Python output.
> 
> I've used PyRun_SimpleString(cmd) to execute the command
> typed in the command line, and this works fine for simple
> statements e.g. print 'hello', but for more complex
> expressions e.g a for loop I get an 'Unexpected EOF while
> parsing' syntax error.
> 
> I'm probably missing something obvious here, but I can't
> see it - any ideas?

You may have forgotten to conclude the string with a
'\n', which is typically needed from the point of view
of Python's syntax (for "dedent"...).

If it's not that, I don't know -- not seeing any examples,
it's too hard to keep guessing.


Alex




More information about the Python-list mailing list