pysal/spint

Notebook `glm_speed` causing issues when converting to markdown

darribas opened this issue · 4 comments

While working on the Notebooks book project, I've encountered the following issue: I cannot convert the glm_speed.ipynb notebook into a markdown file (needed to build the book website):

In [132]: !jupyter nbconvert --to markdown ../book/content/model/spint/glm_speed.ipynb                                                          
[NbConvertApp] Converting notebook ../book/content/model/spint/glm_speed.ipynb to markdown
Traceback (most recent call last):
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/nbformat/reader.py", line 14, in parse_json
    nb_dict = json.loads(s, **kwargs)
  File "/home/dani/anaconda/envs/gds/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/home/dani/anaconda/envs/gds/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/dani/anaconda/envs/gds/lib/python3.6/json/decoder.py", line 355, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 244 column 1 (char 31035)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dani/anaconda/envs/gds/bin/jupyter-nbconvert", line 10, in <module>
    sys.exit(main())
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/nbconvert/nbconvertapp.py", line 325, in start
    self.convert_notebooks()
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/nbconvert/nbconvertapp.py", line 493, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/nbconvert/nbconvertapp.py", line 464, in convert_single_notebook
    output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/nbconvert/nbconvertapp.py", line 393, in export_single_notebook
    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/nbconvert/exporters/exporter.py", line 174, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/nbconvert/exporters/exporter.py", line 192, in from_file
    return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/nbformat/__init__.py", line 141, in read
    return reads(fp.read(), as_version, **kwargs)
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/nbformat/__init__.py", line 74, in reads
    nb = reader.reads(s, **kwargs)
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/nbformat/reader.py", line 58, in reads
    nb_dict = parse_json(s, **kwargs)
  File "/home/dani/anaconda/envs/gds/lib/python3.6/site-packages/nbformat/reader.py", line 17, in parse_json
    raise NotJSONError(("Notebook does not appear to be JSON: %r" % s)[:77] + "...")
nbformat.reader.NotJSONError: Notebook does not appear to be JSON: '{\n "cells": [\n  {\n   "cell_type": "c...

In [133]:

Any ideas why or how to solve it?

I could not even open the notebook locally. I think it is broken?
image

@weikang9009 @darribas I was able to fix the UnreadableNotebook error and will push up a PR later today.

pysal/notebooks#52

The rendering issue is fixed now, so closing for the time being.

I have the same problem back again while building the new book...