I have a test jupyter notebook "Untitled.ipynb" which just consists of one cell with print("Hello").
As a text file this notebook looks like this:
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(\"Hello\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "test-kernel",
"language": "python",
"name": "test-kernel"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
I can perfectly execute it in the .ipynb file, but when I want to run it in the terminal with ipython Untitled.ipynb it returns
(env) ...$ ipython Untitled.ipynb
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
~/.../Untitled.ipynb in <module>
3 {
4 "cell_type": "code",
----> 5 "execution_count": null,
6 "metadata": {},
7 "outputs": [],
NameError: name 'null' is not defined
Based on my google results I manually changed "execution_count" to an integer (e.g. 0, 1) and None. In both cases the error disappears but the terminal doesn't print anything. It just terminates. The weird thing is that it worked a few days ago...The system runs with Linux Ubuntu 18.04, the virtualenv is activated and pip list contains normally everything you need to run an ipython kernel (see below).
ipykernel 5.3.4
ipython 7.2.0
ipython-genutils 0.2.0
jupyter-client 6.1.7
jupyter-core 4.6.3
Does anyone have any idea how to solve this or any hints what I could try?
Here is something I understood about this error
4 "cell_type": "code",
5 "execution_count": null,
6 "metadata": {},
7 "outputs": [],
NameError: name 'null' is not defined
What I learned that this is mainly because there is an empty cell in the python notebook that we are trying to execute something like this:

Just remove the code from {}(stricken by the red line) for that part
OR
open the file in the Jupyternotebook and delete the cell
Or
Add a number in in place of null based on the sequence of the cell
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