Skip to content

diff doesn't work for notebook under lfs #1055

Open
@ebw44

Description

@ebw44

Description

The diff of a notebook track under lfs doesn't work. I get the message Error Loading Notebook Diff: Internal Server Error in the new tab and the error below in the console:

[E 2021-11-09 14:06:23.072 ServerApp.jupyterlab_git] Error computing notebook diff.
    Traceback (most recent call last):
      File "C:\Users\username\mambaforge\lib\site-packages\nbformat\reader.py", line 14, in parse_json
        nb_dict = json.loads(s, **kwargs)
      File "C:\Users\username\mambaforge\lib\json\__init__.py", line 346, in loads
        return _default_decoder.decode(s)
      File "C:\Users\username\mambaforge\lib\json\decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "C:\Users\username\mambaforge\lib\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 "C:\Users\username\mambaforge\lib\site-packages\jupyterlab_git\handlers.py", line 709, in post
        content = await self.git.get_nbdiff(
      File "C:\Users\username\mambaforge\lib\site-packages\jupyterlab_git\git.py", line 361, in get_nbdiff
        prev_nb = await current_loop.run_in_executor(None, read_notebook, prev_content)
      File "C:\Users\username\mambaforge\lib\concurrent\futures\thread.py", line 52, in run
        result = self.fn(*self.args, **self.kwargs)
      File "C:\Users\username\mambaforge\lib\site-packages\jupyterlab_git\git.py", line 352, in read_notebook
        return nbformat.reads(content, as_version=4)
      File "C:\Users\username\mambaforge\lib\site-packages\nbformat\__init__.py", line 73, in reads
        nb = reader.reads(s, **kwargs)
      File "C:\Users\username\mambaforge\lib\site-packages\nbformat\reader.py", line 58, in reads
        nb_dict = parse_json(s, **kwargs)
      File "C:\Users\username\mambaforge\lib\site-packages\nbformat\reader.py", line 17, in parse_json
        raise NotJSONError(("Notebook does not appear to be JSON: %r" % s)[:77] + "...") from e
    nbformat.reader.NotJSONError: Notebook does not appear to be JSON: 'version https://git-lfs.github.com/spec...
[W 2021-11-09 14:06:23.073 ServerApp] Internal Server Error
[E 2021-11-09 14:06:23.090 ServerApp] {
      "Host": "localhost:8888",
      "Connection": "keep-alive",
      "Content-Length": "4093218",
      "Sec-Ch-Ua": "\"Google Chrome\";v=\"95\", \"Chromium\";v=\"95\", \";Not A Brand\";v=\"99\"",
      "Authorization": "token d22641373b435360d2896c5c143a8049569b491f0e9aee58",
      "X-Xsrftoken": "2|9b86ad76|ea46566fea3cecccfa1f550e20597ee5|1634077816",
      "Sec-Ch-Ua-Mobile": "?0",
      "Content-Type": "text/plain;charset=UTF-8",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36",
      "Sec-Ch-Ua-Platform": "\"Windows\"",
      "Accept": "*/*",
      "Origin": "http://localhost:8888",
      "Sec-Fetch-Site": "same-origin",
      "Sec-Fetch-Mode": "cors",
      "Sec-Fetch-Dest": "empty",
      "Referer": "http://localhost:8888/lab",
      "Accept-Encoding": "gzip, deflate, br",
      "Accept-Language": "en-US,en;q=0.9,fr;q=0.8",
      "Cookie": "_xsrf=2|9b86ad76|ea46566fea3cecccfa1f550e20597ee5|1634077816; username-localhost-8889=\"2|1:0|10:1634864179|23:username-localhost-8889|44:N2M3ZWNhNDMxYmNlNGM0NGEzZmE5MTYwMGZlMmQzNmY=|253c54a46b14ca8372b4e2cae96bea7624777f549ab0109ab8e2084bd8d13b7d\"; username-localhost-8888=\"2|1:0|10:1636419982|23:username-localhost-8888|44:N2MwYzYxNTAwNDYwNDg5N2E1MjA2OGNhOGRkNzRlNzU=|f698be6a8b2483595ca8c79e87bb5253f575f62090d974df879edf9dc06b496e\""
    }

I had the same issue with nbdime#608 and it was solved by doing some changes in the .git/config and .gitattributes files

Context

  • Python package version:
    jupyterlab-git 0.33.0 pyhd8ed1ab_0 conda-forge
  • Extension version:
    @jupyterlab/git v0.33.0 enabled ok (python, jupyterlab-git)
  • Git version:
    git version 2.33.1.windows.1
    git-lfs/3.0.1 (GitHub; windows amd64; go 1.17.1)
  • Operating System and its version:
    Windows 10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions