embedded python question
Keith S.
keith_s at ntlworld.nospam.com
Fri Jul 26 06:21:06 EDT 2002
Chris Liechti wrote:
> this class isn't what you want... you need to supply a callable either name
> that method __call__ and add a "return" of the result, or much simpler,
> leave it away and use your "input" directly below.
OK, so now I do:
PyRun_SimpleString("interact('---Starting Python---', input)\n");
where my input function looks like:
static PyObject * input(PyObject *self, PyObject *args)
{
char *string;
if (!PyArg_ParseTuple(args, "s", &string))
return 0;
gld::gMsgView()->printf(MSG_NONE, "%s", string);
return PyString_FromString("");
}
(I'm returning an empty string just to test the above). This goes
into an infinite loop - I'd have expected it to output the prompt
'>>>' once, then wait for a non-null string.
Any ideas what's wroong? I've looked at the implementation of
builtin_raw_input() and can't find any clues to help.
- Keith
More information about the Python-list
mailing list