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