As I understand it, I should be able to print the variable foo in the snippet below.
from IPython.display import HTML
HTML('''
<script type="text/javascript">
IPython.notebook.kernel.execute("foo=97")
</script>
''')
print(foo)
Instead, I see this error message:
NameErrorTraceback (most recent call last)
<ipython-input-2-91b73ee49ec6> in <module>()
5 </script>
6 ''')
----> 7 print(foo)
NameError: name 'foo' is not defined
I'm trying to use this answer but struggling to make it work.
FWIW, this is the latest Jupyter code (according to pip) running on Fedora 23. What are the prerequisites to make this work?
This is how I made your code work:

or even simpler:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With