In jupyter notebook I can set a Python variable using javascript by doing
%%javascript
IPython.kernel.execute("foo=56");
However in Jupyter Lab I get "Javascript Error: IPython is not defined"
How can I set a python variable using javascript in Jupyter lab, in a similar way to Jupyter notebook?
IPython is a JavaScript object which does not exist in JupyterLab, only in Notebooks. See this question:
Executing Java script code in JupyterLab gives error
And also this lengthy bug report/discussion on GitHub:
https://github.com/jupyterlab/jupyterlab/issues/5660
TL;DR: Currently there is no approved solution to this, but people are working on it.
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