embedded python: "integer is required", when calling PyRun_SimpleString

Heiko Köhler mail at heikokoehler.de
Mon Mar 10 13:04:09 CET 2003


"Martin v. Löwis" wrote:

> Heiko Köhler wrote:
>> Im writting a QT and Scintilla based text editor with an embedded python
>> interpreter. Sometimes when I call PyRun_SimpleString( "any_string")
>> python aborts with message: "an integer is required". But when I call
>> PyRun_SimpleString("pass"); PyRun_SimpleString("any_string") it works.
> 
> I guess the implied question is: Why does that happen?
> 
> This is difficult to tell: it depends on the actual value of
> "any_string". Most likely, that contains a function call which requires
> integers.
> 
> Regards,
> Martin

A concret example:
        PyRun_SimpleString("print \"Hello\"");
will cause the interpreter to abort too, but
        PyRun_SimpleString("pass");
        PyRun_SimpleString("print \"Hello\"");
works.
The print function does not require an integer.

Heiko




More information about the Python-list mailing list