embedded python question

Keith S. keith_s at ntlworld.nospam.com
Wed Jul 24 09:11:42 EDT 2002


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):

void gld_cmdview::cmdExec()
{
	QString s = m_cmdview->text();
	char *cmd = (char *) s.latin1();

	// Run the cmd
	(void) PyRun_SimpleString(cmd);

	m_cmdview->clear();
}

The error message I get is like the following:

   File "
<string>
", line
1


for x in [1, 2, 3]:

^
SyntaxError
:
unexpected EOF while parsing




More information about the Python-list mailing list