embedded python question
Alex Martelli
aleax at aleax.it
Wed Jul 24 09:25:41 EDT 2002
Keith S. wrote:
> Alex Martelli wrote:
>
>> 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"...).
>
> The bit that drives Python is like this (I'm using
> QT for the GUI, and m_cmdview is just a pointer to
> the QLineEdit widget):
QLineEdit handles (and returns) a single line, right? Therefore, how
can you use it to input a multi-line command?
> for x in [1, 2, 3]:
>
> ^
> SyntaxError
> :
> unexpected EOF while parsing
The string seems to be finished here (where no doubt there
was a newline) which indeed IS a syntax error exactly for
the given reason.
Why not use a multiline editing widget instead?
Alex
More information about the Python-list
mailing list