[IPython-User] html notebook js-python interaction

Vincent Schut schut@sarvision...
Fri Sep 21 04:56:17 CDT 2012


On 09/20/12 16:17, Matthias BUSSONNIER wrote:
>
> Le 20 sept. 2012 à 15:53, Vincent Schut a écrit :
>
>> Hi,
>>
>> I'm trying to get js-python interaction in the html notebook working
>> (read: kernel.execute(pyfunc, callbacks), callbacks alter the current
>> notebook output).
>>
>> I found this gist: https://gist.github.com/2605662 that should basically
>> do what I want, however, I cannot get it to work. If I load it (firefox
>> 15.0.1, ipython 0.13), I get no plot, the sliders are locked, and the
>> javascript console sais 'TypeError: kernel is null'.
>> I also tried with current 0.14, gives the same (output: Error rendering
>> Markdown! TypeError: kernel is null)
>
> Hi Vincent,
>
> You need to re-execute **every** cell, meaning editing each markdown cell that contain JS (even without making a change)
> And run them again.
>
> On 0.14 it Works™
>
> Have fun.
>
After some hours of fun, I got it working. New version: 
https://gist.github.com/3760665

Actually I don't know how I got the 'kernel is null' thing solved. 
However, there was a python3 incompatibility in the update_plot 
function: in python3, zip returns a generator object, on which 
JSON.dumps chokes.
I also added a try/except block which passes the backtrace as html to 
the notebook, which renders it above the plot area is there is a python 
error.

Now on to more fun :-)

Best,
Vincent.


More information about the IPython-User mailing list