embedded python question

Chris Liechti cliechti at gmx.net
Fri Jul 26 08:19:47 EDT 2002


"Keith S." <keith_s at ntlworld.nospam.com> wrote in 
news:3D413883.4000004 at ntlworld.nospam.com:

> Chris Liechti wrote:
> 
>> just return some real data, "print 'hello'\n" or so.
>> and i think you can exit the interactive loop by raising an EOFError 
>> exception.
> 
> Unfortunately returning any real data still loops.
> I guess interact is not what I'm looking for, then.

yes code.interact stays in the interactive loop until a
sys.exit() of EOFError.

> I want a C function (that is a Qt slot which responds
> to a signal that the user has hit return in a QLineEdit
> widget) to send a string to the Python interpreter
> in much the same way as the interactive shell does,
> with the interpreter waiting for more input if required.

have a look at the python source of code.py and pycrust maybe idle and 
pythonwin too. the trick is to compile the input after each line and look 
if there is an error and on some errors, just continue to read.

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list