Closed antoine-galataud closed 1 year ago
In addition, when you enable jupyter-collaboration extension for real time collaboration, opening a notebook will raise a JSON parsing exception such as following:
[E 2023-06-09 13:22:32.957 ServerApp] Error initializing: notebook.ipynb
NotJSONError("Notebook does not appear to be JSON: 'eyJtZXRhZGF0YSI6IHsia2VybmVsc3BlYyI6IHs...")
Traceback (most recent call last):
File "/home/jupyter/.local/lib/python3.10/site-packages/nbformat/reader.py", line 20, in parse_json
nb_dict = json.loads(s, **kwargs)
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jupyter/.local/lib/python3.10/site-packages/jupyter_collaboration/handlers.py", line 167, in open
await self.room.initialize()
File "/home/jupyter/.local/lib/python3.10/site-packages/jupyter_collaboration/rooms.py", line 98, in initialize
model = await self._file.load_content(self._file_format, self._file_type, True)
File "/home/jupyter/.local/lib/python3.10/site-packages/jupyter_collaboration/loaders.py", line 115, in load_content
self._contents_manager.get(
File "/home/jupyter/.local/lib/python3.10/site-packages/s3contents/genericmanager.py", line 135, in get
return func(path=path, content=content, format=format)
File "/home/jupyter/.local/lib/python3.10/site-packages/s3contents/genericmanager.py", line 154, in _get_notebook
return self._notebook_model_from_path(
File "/home/jupyter/.local/lib/python3.10/site-packages/s3contents/genericmanager.py", line 295, in _notebook_model_from_path
nb_content = reads(file_content, as_version=NBFORMAT_VERSION)
File "/home/jupyter/.local/lib/python3.10/site-packages/nbformat/__init__.py", line 89, in reads
nb = reader.reads(s, **kwargs)
File "/home/jupyter/.local/lib/python3.10/site-packages/nbformat/reader.py", line 76, in reads
nb_dict = parse_json(s, **kwargs)
File "/home/jupyter/.local/lib/python3.10/site-packages/nbformat/reader.py", line 26, in parse_json
raise NotJSONError(message) from e
nbformat.reader.NotJSONError: Notebook does not appear to be JSON: 'eyJtZXRhZGF0YSI6IHsia2VybmVsc3BlYyI6IHs...
This was tested only with AWS S3 as a storage backend. The fix hence only focuses on s3_fs.
Jupyter Notebook 7 is about to be released (as of writing, b3 released).
In this new version, most of the backend is based on Jupyter server. While https://github.com/danielfrg/s3contents/issues/161 has solved some compatibility issues, some problem remains.
For instance, there are still some
notebook.*
imports inipycompat.py
that raise exceptions on startup:I will PR a change that I've just tested to make it compatible with Notebook 7.