-
Notifications
You must be signed in to change notification settings - Fork 97
error "Notebook does not appear to be JSON: ''...", #171
Comments
There might be a copy saved in a folder called |
Coincidentally, someone just posted a link to how you might be able to recover notebook data from your browser cache: |
Hello @takluyver. Hope I'm not hijacking this thread. If so I can open a new one if you want me to. Just wanted to share with you that I am also getting this error a lot recently. After saving a notebook and trying to open it later I get "error loading notebook" and references "NotJSONError('Notebook does not appear to be JSON: '{\n "cells": [\n {\n "cell_type": "c...',)". When I look at the .ipynb file there is "extra" JSON with two sets of opening and closing {}. So I have to delete the second set in order to restore the file. It's as if it's duplicating the JSON - or maybe holding onto bits from previous saves? This is happening a lot and I'm not sure that I've done anything that would change the way Jupyter Notebook saves. I run regular updates via conda. I use Chrome as the default browser for notebooks. Do you have any suggestions for troubleshooting this? |
That's bizarre. Can you share one of the corrupted notebooks in a gist or something? |
Thanks for responding. I apologize for the delay in getting back to you. Let me see if I can re-create the issue in a test file. If I cannot reproduce it, I'll remove the proprietary stuff in one of the files that has the issue and share that with you. |
Ok I wrote some test code and saved and went to open and got the error. This happens in both Chrome and Firefox. The JSON from the ipynb file is at https://gist.github.com/2ndg33r/d29c539309349859d76c4787a2bd41cd#file-20170806_recreate_notebook_issue-txt. You can see at line 291 is where it goes wrong. Line 292 is another closing } which is out of place. Interestingly, this only happens on Windows. I ran the same thing in a notebook on a Linux machine and I don't have this problem. At least I haven't yet...so perhaps it's something with my Windows build. I even replicated the Pandas code errors and on Linux and the notebook opens without an issue. Thanks for your time. |
That's weird - it looks like a valid notebook has been written over a slightly longer notebook file several times, without truncating the file. You can see the ending of a notebook on line 290, line 292, line 342, and line 385. The resulting file is certainly invalid, but if you cut it off at line 290, it's a valid notebook that I can open. I don't know what would cause that. Do you have any custom configuration or anything? Is there anything unusual about the filesystem you're saving it on? What Python version are you running the notebook server in? Can you try uninstalling and reinstalling Jupyter, or even Python itself? It's possible that we're doing something wrong on saving files on Windows, but if we were I think we'd have been inundated with reports of it already. |
Yeah I agree. I didn't see really any other issue reports similar to this and is working fine on another system so this doesn't seem to be an issue with Jupyter Notebook. The changes I made to the jupyter config file is the c.NotebookApp.notebook_dir points to an external drive. And I changed the default browser. I think I'll start with restoring the default notebook_dir and see what happens with that. |
External as in USB hard drive, or as in a network disk? My best guess is that that's the source of the issue, but it's still really weird. |
External USB. You were right that was the issue. Since restoring the notebook directory to my local drive I haven't had any problems. Thanks for your time on this. |
No problem. I'm still curious about what's going on - I don't think we do anything particularly unusual to write files. But unless you're willing to invest quite a bit of time investigating it, I think it has to go down as something we can't fix. |
Hey there! Just adding on that I'm also getting Unreadable Notebook: NotJSONError('Notebook does not appear to be JSON: u'{\n "cells": [\n {\n "cell_type": "...',) randomly when I open my jupyter notebook files. It happened twice in the last month, though it had never happened before hand. Just to note, I use Linux. |
I would suggest looking into the raw I have done this in the past and found there was a "diff" in there, resulting from a bad/unfinished Git conflict. Jupyter can't open a file in this state as the conflict basically leaves a syntax error in the JSON, which cannot then be parsed. In my case, I was able to manually delete one of the parts - the notebook then opened as usual. Example - it might look something like this:
So you would just delete one side of this, leaving for example:
|
just open the ipynb file with a text editor and check the latest line in the file |
Hello,
I had a notebook saved in a server with some python code but suddenly I get this error when trying to open it : Unreadable Notebook: /path/FILENAME.ipynb NotJSONError("Notebook does not appear to be JSON: ''...",). Furthermore the notebook is now empty (0 byte). Is there any chance I might see my code again?
Thanks in advance
The text was updated successfully, but these errors were encountered: