[IPython-dev] execute() in IPython widgets

Steve Jackson steve.jackson at icecube.wisc.edu
Wed May 15 11:56:53 EDT 2013


Thanks for the quick reply…

On May 15, 2013, at 10:32 AM, Matthias BUSSONNIER <bussonniermatthias at gmail.com> wrote:

> Have a look at  run -i

This is good to know about, but it doesn't solve my particular problem (more below).

> Why not load the file like %%load does, or set the content of input buffer (stripping 2 first line if there is encoding declaration and shebang) and then execute it ?

These approaches don't help me (I don't seem to have a %%load function, though I do have %load).  But this have helped me isolate the problem with print messages.  If I execute the following lines:

widget.input_buffer = "print 'Hello'"
widget.execute( interactive=True )

 then the following output appears in the widget:

In [1]: print 'Hello'

However, the actual print statement is not echoed in the widget, as it would have if the command had been executed in response to user keyboard input.
~S





More information about the IPython-dev mailing list