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

Fernando Perez fperez.net@gmail....
Sun Jan 8 13:24:51 CST 2012


On Sat, Jan 7, 2012 at 11:14 PM, MinRK <benjaminrk@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>')

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...

Cheers,

f


More information about the IPython-dev mailing list