These is no way to go around that, the messages and execution requests
are queued as the ZMQ layer.
So you submit cell 2 before `kernel.execute(command) ;` to be back on the bage.

So execute all will always have this behavior.

-- 
M

On Wed, Aug 3, 2016 at 10:38 AM, marq h <[email protected]> wrote:
> Hi Jupyter folks
>
> I am puzzled by the behaviour in this case:
>
> Cell 1
> import IPython
> javascript = """
>     var url = window.location;
>
>         var command = "url" + " = '" + url + "'";
>
>         var kernel = IPython.notebook.kernel;
>
>
>         kernel.execute(command) ;
> """
> IPython.display.display(IPython.display.Javascript(javascript))
>
>
>
> Cell 2
> print(url)
>
>
> If I run cell 1, then run cell 2, by hand, one after the other, then all is
> fine: the url is printed.  If i 'run all' then the "name 'url' is not
> defined" (this is the case if i rerun cell 2, after having run all)
>
> It's like that kernel.execute is being trampled on by the print and the url
> variable is never properly assigned.
>
> I've tried time.sleep and other work around steps but to no avail, if i run
> all, then the kernel.execute doesn't make a result.  Any python code
> following cell 1 seems to trigger this problem
>
> any advice on how to deal with this would be very gratefully received
> cheers
> mark
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/473bf13c-13a9-46cc-8ed1-8f49170d3506%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CANJQusV5kHEgCUoMe9_DXQNKp3yKONJfPa2Ar%2Bhqq8O3NpQK%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to