Skip to content

NotJSONError raised in wait_and_check_if_empty() #432

@andradecEN

Description

@andradecEN

Description

What steps will reproduce the problem?

I just started using spyder this morning, i was installing matplotlib with the prompt, then during the execution I wanted to close one tab in the spyder notebook

Traceback

Traceback (most recent call last):
  File "C:\Users\andradec\AppData\Local\anaconda3\envs\SpyNbk\lib\site-packages\nbformat\reader.py", line 20, in parse_json
    nb_dict = json.loads(s, **kwargs)
  File "C:\Users\andradec\AppData\Local\anaconda3\envs\SpyNbk\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\andradec\AppData\Local\anaconda3\envs\SpyNbk\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\andradec\AppData\Local\anaconda3\envs\SpyNbk\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\andradec\AppData\Local\anaconda3\envs\SpyNbk\lib\site-packages\spyder_notebook\widgets\notebooktabwidget.py", line 242, in close_client
    filename = self.save_notebook(client)
  File "C:\Users\andradec\AppData\Local\anaconda3\envs\SpyNbk\lib\site-packages\spyder_notebook\widgets\notebooktabwidget.py", line 278, in save_notebook
    if self.wait_and_check_if_empty(filename):
  File "C:\Users\andradec\AppData\Local\anaconda3\envs\SpyNbk\lib\site-packages\spyder_notebook\widgets\notebooktabwidget.py", line 320, in wait_and_check_if_empty
    nb_contents = nbformat.read(filename, as_version=4)
  File "C:\Users\andradec\AppData\Local\anaconda3\envs\SpyNbk\lib\site-packages\nbformat\__init__.py", line 169, in read
    return reads(f.read(), as_version, capture_validation_error, **kwargs)
  File "C:\Users\andradec\AppData\Local\anaconda3\envs\SpyNbk\lib\site-packages\nbformat\__init__.py", line 89, in reads
    nb = reader.reads(s, **kwargs)
  File "C:\Users\andradec\AppData\Local\anaconda3\envs\SpyNbk\lib\site-packages\nbformat\reader.py", line 76, in reads
    nb_dict = parse_json(s, **kwargs)
  File "C:\Users\andradec\AppData\Local\anaconda3\envs\SpyNbk\lib\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: ''

Versions

  • Spyder version: 5.4.3 (conda)
  • Python version: 3.10.11 64-bit
  • Qt version: 5.15.6
  • PyQt5 version: 5.15.7
  • Operating System: Windows 10

Dependencies

# Mandatory:
atomicwrites >=1.2.0                             :  1.4.1 (OK)
chardet >=2.0.0                                  :  5.1.0 (OK)
cloudpickle >=0.5.0                              :  2.2.1 (OK)
cookiecutter >=1.6.0                             :  2.1.1 (OK)
diff_match_patch >=20181111                      :  20230430 (OK)
intervaltree >=3.0.2                             :  3.1.0 (OK)
IPython >=7.31.1,<9.0.0,!=8.8.0,!=8.9.0,!=8.10.0 :  8.14.0 (OK)
jedi >=0.17.2,<0.19.0                            :  0.18.2 (OK)
jellyfish >=0.7                                  :  0.9.0 (OK)
jsonschema >=3.2.0                               :  4.17.3 (OK)
keyring >=17.0.0                                 :  24.0.0 (OK)
nbconvert >=4.0                                  :  7.6.0 (OK)
numpydoc >=0.6.0                                 :  1.5.0 (OK)
paramiko >=2.4.0                                 :  3.2.0 (OK)
parso >=0.7.0,<0.9.0                             :  0.8.3 (OK)
pexpect >=4.4.0                                  :  4.8.0 (OK)
pickleshare >=0.4                                :  0.7.5 (OK)
psutil >=5.3                                     :  5.9.5 (OK)
pygments >=2.0                                   :  2.15.1 (OK)
pylint >=2.5.0,<3.0                              :  2.17.4 (OK)
pylint_venv >=2.1.1                              :  3.0.2 (OK)
pyls_spyder >=0.4.0                              :  0.4.0 (OK)
pylsp >=1.7.2,<1.8.0                             :  1.7.3 (OK)
pylsp_black >=1.2.0                              :  1.3.0 (OK)
qdarkstyle >=3.0.2,<3.2.0                        :  3.1 (OK)
qstylizer >=0.2.2                                :  0.2.2 (OK)
qtawesome >=1.2.1                                :  1.2.3 (OK)
qtconsole >=5.4.2,<5.5.0                         :  5.4.3 (OK)
qtpy >=2.1.0                                     :  2.3.1 (OK)
rtree >=0.9.7                                    :  1.0.1 (OK)
setuptools >=49.6.0                              :  67.7.2 (OK)
sphinx >=0.6.6                                   :  7.0.1 (OK)
spyder_kernels >=2.4.3,<2.5.0                    :  2.4.3 (OK)
textdistance >=4.2.0                             :  4.5.0 (OK)
three_merge >=0.1.1                              :  0.1.1 (OK)
watchdog >=0.10.3                                :  3.0.0 (OK)
zmq >=22.1.0                                     :  25.1.0 (OK)

# Optional:
cython >=0.21                                    :  None (NOK)
matplotlib >=3.0.0                               :  None (NOK)
numpy >=1.7                                      :  1.25.0 (OK)
pandas >=1.1.1                                   :  1.5.3 (OK)
scipy >=0.17.0                                   :  None (NOK)
sympy >=0.7.3                                    :  None (NOK)

# Spyder plugins:
spyder_notebook.notebookplugin 0.4.1             :  0.4.1 (OK)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions