I wanted to get the list of running servers using the command-line:
jupyter notebook list
I get an error:
Traceback (most recent call last):
File "/home/sarah/anaconda3/envs/py27/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/home/sarah/anaconda3/envs/py27/lib/python2.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/sarah/anaconda3/envs/py27/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/home/sarah/anaconda3/envs/py27/lib/python2.7/site-packages/notebook/notebookapp.py", line 1571, in start
super(NotebookApp, self).start()
File "/home/sarah/anaconda3/envs/py27/lib/python2.7/site-packages/jupyter_core/application.py", line 255, in start
self.subapp.start()
File "/home/sarah/anaconda3/envs/py27/lib/python2.7/site-packages/notebook/notebookapp.py", line 483, in start
serverinfo_list = list(list_running_servers(self.runtime_dir))
File "/home/sarah/anaconda3/envs/py27/lib/python2.7/site-packages/notebook/notebookapp.py", line 1667, in list_running_servers
info = json.load(f)
File "/home/sarah/anaconda3/envs/py27/lib/python2.7/json/__init__.py", line 291, in load
**kw)
File "/home/sarah/anaconda3/envs/py27/lib/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/home/sarah/anaconda3/envs/py27/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/sarah/anaconda3/envs/py27/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
How to correct it? I don't understand the reason.
The logic for determining running notebook servers relies on iterating over all files in runtime-dir with prefix "nbserver-" and trying to load as JSON. Therefore, a malformed file in this folder may be causing the JSON error. Solved this by deleting all files under the Jupyter runtime-dir:
$ jupyter --runtime-dir
/home/user/.local/share/jupyter/runtime
$ cd $(jupyter --runtime-dir) && rm *
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