[IPython-dev] Odd notebook file that can't be loaded.

MinRK benjaminrk at gmail.com
Sun Jan 8 14:41:39 EST 2012

On Sun, Jan 8, 2012 at 11:24, Fernando Perez <fperez.net at gmail.com> wrote:

> On Sat, Jan 7, 2012 at 11:14 PM, MinRK <benjaminrk at gmail.com> wrote:
> > Your script in the markdown cell is being executed before the kernel
> exists,
> > and thus fails ('null has no execute' message in js console).  Since this
> > raises an error, the javascript execution that was loading the notebook
> > (which ultimately caused your javascript to execute) halts at this point,
> > failing to finish loading the notebook.  I don't know if we can protect
> > against this sort of thing, but we should if we can.  If you write the
> code
> > so it can't raise (check for existence, etc.), then it should be safe.
>  You
> > may need to put the execute on a timeout, to allow it to run after the
> > kernel connection is established.
> Interesting, thanks for looking into it; I was wiped yesterday when I
> ran into this.
> What puzzles me is that even this simpler notebook will exhibit the
> same problem.  Just put this in one cell:
> from IPython.core.display import HTML
> HTML('<script>IPython.notebook.kernel.execute("x=1")</script>')

It shouldn't need to have anything to do with IPython - I think any
error-raising javascript should be able to cause this problem:

from IPython.core.display import HTML

> save it and hit reload.  Boom.
> In this case there's no markdown, it's the html repr that gets loaded
> on opening and has the same effect.  I wonder if we can protect in
> some way against this locking things up for users...

I don't know enough about javascript machinery to see a way to protect from
this, but it should be possible.

> Cheers,
> f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20120108/ee050896/attachment.html>

More information about the IPython-dev mailing list