gpt4 book ai didi

python - Jupyter 无法打开笔记本,错误 : 'File "XX"has unsaved changes, 关闭而不保存?

转载 作者:行者123 更新时间:2023-12-03 19:23:09 26 4
gpt4 key购买 nike

我在使用分布式文件系统的机器集群上运行 Jupyter 笔记本。

一段时间后,由于错误,我无法打开新笔记本:

Close without saving?
File "XXX.ipynb" has unsaved changes, close without saving?

查看 Jupyter 日志,我可以看到出现此错误是因为 nbsignatures.db数据库被锁定。

[E 15:58:01.190 LabApp] Uncaught exception GET /api/contents/workspace/proteinsolver/notebooks/XXX.ipynb?type=notebook&content=1&1572638276143 (10.74.73.2)
HTTPServerRequest(protocol='http', host='localhost:9416', method='GET', uri='/api/contents/workspace/proteinsolver/notebooks/04_sudoku_train-01-Copy8.ipynb?type=notebook&content=1&1572638276143', version='HTTP/1.1', remote_ip='10.74.73.2')
Traceback (most recent call last):
File "/home/username/miniconda3/lib/python3.7/site-packages/tornado/web.py", line 1699, in _execute
result = await result
File "/home/username/miniconda3/lib/python3.7/site-packages/tornado/gen.py", line 209, in wrapper
yielded = next(result)
File "/home/username/miniconda3/lib/python3.7/site-packages/notebook/services/contents/handlers.py", line 112, in get
path=path, type=type, format=format, content=content,
File "/home/username/miniconda3/lib/python3.7/site-packages/notebook/services/contents/filemanager.py", line 433, in get
model = self._notebook_model(path, content=content)
File "/home/username/miniconda3/lib/python3.7/site-packages/notebook/services/contents/filemanager.py", line 392, in _notebook_model
self.mark_trusted_cells(nb, path)
File "/home/username/miniconda3/lib/python3.7/site-packages/notebook/services/contents/manager.py", line 508, in mark_trusted_cells
trusted = self.notary.check_signature(nb)
File "/home/username/miniconda3/lib/python3.7/site-packages/nbformat/sign.py", line 439, in check_signature
return self.store.check_signature(signature, self.algorithm)
File "/home/username/miniconda3/lib/python3.7/site-packages/nbformat/sign.py", line 232, in check_signature
""", (algorithm, digest)).fetchone()
sqlite3.OperationalError: database is locked

我解决这个问题的最简单方法是什么?

最佳答案

是否有可能在 git 中维护笔记本并且存在合并冲突?请参阅此解决方案:https://stackoverflow.com/a/61031136/4001214当我遇到这个问题时,它修复了我的。

当 git 无法解决文本文件中的冲突时,它会将其合理差异的想法放入文件中。这破坏了 .ipynb 的 JSON 结构,使其在 jupyter 中不可读。在链接的解决方案中,作者显示

<<<<<<< HEAD
},
{
<CONTENTS OF MY CELL>
]
=======
>>>>>>> a23f8f8f9db0974b7de90c6e7ed8599fa04d53cc

并指出使用文本编辑器从文件中删除有问题的行解决了这个问题。就我而言,我在 git 中有一个已知良好的文件,所以我删除了本地副本并重新拉取。

关于python - Jupyter 无法打开笔记本,错误 : 'File "XX"has unsaved changes, 关闭而不保存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58665591/

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