gpt4 book ai didi

python - Jupyter Notebook 运行服务器列表 - ValueError : No JSON object could be decoded

转载 作者:行者123 更新时间:2023-12-01 00:18:16 25 4
gpt4 key购买 nike

我想使用命令行获取正在运行的服务器列表:

jupyter notebook list

我收到一个错误:
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

如何纠正?我不明白原因。

最佳答案

确定正在运行的笔记本服务器的逻辑依赖于迭代运行时目录中带有前缀“nbserver-”的所有文件,并尝试加载为 JSON。因此,此文件夹中的格式错误的文件可能会导致 JSON 错误。通过删除 Jupyter 运行时目录下的所有文件解决了这个问题:

$ jupyter --runtime-dir
/home/user/.local/share/jupyter/runtime
$ cd $(jupyter --runtime-dir) && rm *

关于python - Jupyter Notebook 运行服务器列表 - ValueError : No JSON object could be decoded,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50743275/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com