Error when opening .ipynb in JupyterLab - “Close without saving?”

和自甴很熟 提交于 2020-07-09 11:59:48

问题


When I try to open my .ipynb, I get the following error. Other notebooks in the same directory work just fine.

UI Error:

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

Browser console errors:

serverconnection.js:192 GET http://localhost:8890/api/contents/cloner.ipynb?type=notebook&content=1&1586015957921 400 (Bad Request)
handleRequest @ serverconnection.js:192
makeRequest @ serverconnection.js:76
get @ index.js:477
get @ index.js:170
(anonymous) @ context.js:498
Promise.then (async)
_revert @ context.js:497
initialize @ context.js:190
(anonymous) @ manager.js:445
Promise.then (async)
_createOrOpenDocument @ manager.js:445
open @ manager.js:274
openOrReveal @ manager.js:298
_handleOpen @ listing.js:824
_evtDblClick @ listing.js:900
handleEvent @ listing.js:543


context.js:582 Uncaught (in promise) TypeError: Failed to execute 'text' on 'Response': body stream is locked
    at Context._handleError (context.js:582)
    at context.js:540
_handleError @ context.js:582
(anonymous) @ context.js:540
async function (async)
_handleError @ context.js:582
(anonymous) @ context.js:540
async function (async)
(anonymous) @ context.js:536
Promise.catch (async)
_revert @ context.js:533
initialize @ context.js:190
(anonymous) @ manager.js:445
Promise.then (async)
_createOrOpenDocument @ manager.js:445
open @ manager.js:274
openOrReveal @ manager.js:298
_handleOpen @ listing.js:824
_evtDblClick @ listing.js:900
handleEvent @ listing.js:543

Pip-managed package versions:

Name: jupyter
Version: 1.0.0
Summary: Jupyter metapackage. Install all the Jupyter components in one go.

Name: jupyterlab
Version: 2.0.1
Summary: The JupyterLab notebook server extension.

I tried deleting my .ipynb_checkpoints folder, and am tracking all this stuff in git.

Looking at the Jupyter logs, I can see that this error arrises because the nbsignatures.db database is locked. https://www.onooks.com/jupyter-fails-to-open-notebook-with-error-file-xx-has-unsaved-changes-close-without-saving/


回答1:


Looks like a git merge conflict added non-json lines to my file.

Looking inside cloner.ipynb source file w text editor:

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

Deleted those non-json lines and am back in business.



来源:https://stackoverflow.com/questions/61030900/error-when-opening-ipynb-in-jupyterlab-close-without-saving

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!