3

I now get the following error when trying to open 2 Jupyter notebooks in the notebook web file browser:

enter image description here

This occurred after I had done a series of move and copy operations in the terminal in an attempt to resolve a git merge conflict:

$ mv Development-of-TD-Lambda-algorithm.ipynb Coding-TD-Lambda-algorithm.ipynb

I then tried to reverse that, deciding instead to copy the file:

$ mv Coding-TD-Lambda-algorithm.ipynb Development-of-TD-Lambda-algorithm.ipynb
$ cp Development-of-TD-Lambda-algorithm.ipynb Coding-TD-Lambda-algorithm.ipynb Development-of-TD-Lambda-algorithm.ipynb
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory

(Oops - that didn't work)

$ cp Development-of-TD-Lambda-algorithm.ipynb Coding-TD-Lambda-algorithm.ipynb

After doing these, I then did the following:

$ git checkout Development-of-TD-Lambda-algorithm.ipynb

Now both notebooks seem to be corrupt or something. I was under the impression that copying/moving notebook files should not cause problems. Does anyone know what has happened here or how to get either/both notebooks back?

(This error appears to occur a lot for different people but I can't find an example where it occurred after a file move/copy.)

Here is the recent contents of the notebook server terminal window:

[I 21:10:25.115 NotebookApp] The Jupyter Notebook is running at:
[I 21:10:25.115 NotebookApp] http://localhost:8888/?token=b76cb86e9dd238f36b14615a3fe30d973cdc8c2fd54b6904
[I 21:10:25.115 NotebookApp]  or http://127.0.0.1:8888/?token=b76cb86e9dd238f36b14615a3fe30d973cdc8c2fd54b6904
[I 21:10:25.115 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 21:10:25.125 NotebookApp] 

    To access the notebook, open this file in a browser:
        file:///Users/billtubbs/Library/Jupyter/runtime/nbserver-5321-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=b76cb86e9dd238f36b14615a3fe30d973cdc8c2fd54b6904
     or http://127.0.0.1:8888/?token=b76cb86e9dd238f36b14615a3fe30d973cdc8c2fd54b6904
[W 21:10:32.103 NotebookApp] Notebook Development-of-N-step-TDLearner-algorithm.ipynb is not trusted
[I 21:10:32.215 NotebookApp] 302 GET /notebooks/images/td_n_step.png (::1) 0.98ms
[I 21:10:32.241 NotebookApp] 302 GET /notebooks/images/fig_7_2.png (::1) 1.07ms
[I 21:10:32.303 NotebookApp] 302 GET /notebooks/images/figure_7_2.png (::1) 1.00ms
[I 21:10:38.385 NotebookApp] Kernel started: 5e6da9f8-0e4c-4dee-b5d9-6e17e15b6e50
[I 21:10:40.217 NotebookApp] Saving file at /Development-of-N-step-TDLearner-algorithm.ipynb
[W 21:10:40.219 NotebookApp] Notebook Development-of-N-step-TDLearner-algorithm.ipynb is not trusted
[I 21:10:44.123 NotebookApp] Starting buffering for 5e6da9f8-0e4c-4dee-b5d9-6e17e15b6e50:5934e4aba9e6482391337f30cc0ed290
[I 21:10:44.332 NotebookApp] Kernel shutdown: 5e6da9f8-0e4c-4dee-b5d9-6e17e15b6e50
[W 21:10:47.175 NotebookApp] 400 GET /api/contents/Development-of-TD-Lambda-algorithm.ipynb?type=notebook&_=1571890247090 (::1): Unreadable Notebook: /Users/billtubbs/game-learner/Development-of-TD-Lambda-algorithm.ipynb NotJSONError('Notebook does not appear to be JSON: \'{\\n "cells": [\\n  {\\n   "cell_type": "m...')
[W 21:10:47.176 NotebookApp] Unreadable Notebook: /Users/billtubbs/game-learner/Development-of-TD-Lambda-algorithm.ipynb NotJSONError('Notebook does not appear to be JSON: \'{\\n "cells": [\\n  {\\n   "cell_type": "m...')
[W 21:10:47.176 NotebookApp] 400 GET /api/contents/Development-of-TD-Lambda-algorithm.ipynb?type=notebook&_=1571890247090 (::1) 3.05ms referer=http://localhost:8888/notebooks/Development-of-TD-Lambda-algorithm.ipynb
[W 21:18:19.670 NotebookApp] 400 GET /api/contents/Development-of-TD-Lambda-algorithm.ipynb?type=notebook&_=1571890699566 (::1): Unreadable Notebook: /Users/billtubbs/game-learner/Development-of-TD-Lambda-algorithm.ipynb NotJSONError('Notebook does not appear to be JSON: \'{\\n "cells": [\\n  {\\n   "cell_type": "m...')
[W 21:18:19.670 NotebookApp] Unreadable Notebook: /Users/billtubbs/game-learner/Development-of-TD-Lambda-algorithm.ipynb NotJSONError('Notebook does not appear to be JSON: \'{\\n "cells": [\\n  {\\n   "cell_type": "m...')
[W 21:18:19.671 NotebookApp] 400 GET /api/contents/Development-of-TD-Lambda-algorithm.ipynb?type=notebook&_=1571890699566 (::1) 3.48ms referer=http://localhost:8888/notebooks/Development-of-TD-Lambda-algorithm.ipynb
[W 21:24:55.067 NotebookApp] 400 GET /api/contents/Coding-TD-Lambda-algorithm.ipynb?type=notebook&_=1571891094965 (::1): Unreadable Notebook: /Users/billtubbs/game-learner/Coding-TD-Lambda-algorithm.ipynb NotJSONError('Notebook does not appear to be JSON: \'{\\n "cells": [\\n  {\\n   "cell_type": "m...')
[W 21:24:55.067 NotebookApp] Unreadable Notebook: /Users/billtubbs/game-learner/Coding-TD-Lambda-algorithm.ipynb NotJSONError('Notebook does not appear to be JSON: \'{\\n "cells": [\\n  {\\n   "cell_type": "m...')
[W 21:24:55.067 NotebookApp] 400 GET /api/contents/Coding-TD-Lambda-algorithm.ipynb?type=notebook&_=1571891094965 (::1) 3.14ms referer=http://localhost:8888/notebooks/Coding-TD-Lambda-algorithm.ipynb

ADDITIONAL INFO

Here is the top of one of the notebook files I am trying to recover:

{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Coding of TD($\\lambda$) learner algorithm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'3.7.1'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from platform import python_version\n",
    "python_version()"
   ]
  },
Bill
  • 10,323
  • 10
  • 62
  • 85

1 Answers1

1

I don't know what caused your specific problem but I know that when I run into issues where I can't open a notebook (usually from a git merge conflict) I open up the notebook in VSCode and that shows the metadata where you can find the issue. It's pretty easy when it's a merge conflict, but depending on what caused your error it might be hard to identify.

jss367
  • 4,759
  • 14
  • 54
  • 76