AnswerDotAI / AnswerDotAI/nbdev

nbdev_new: json.decoder.JSONDecodeError: Expecting ',' delimiter: line 19 column 41 (char 323)

Open
#1,360 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Jupyter Notebook
Stars
5.3k
Forks
513
Avg merge
2d 30m
Merged PRs (30d)
8

Description

On creating a new nbdev project with the `nbdev_new` command, after cloning into an empty git repo as described in the [tutorial](https://nbdev.fast.ai/tutorials/tutorial.html#initialise-your-repo-with-nbdev), I get the following error:

Traceback (most recent call last):
File "/home/ndev_env/bin/nbdev_new", line 8, in
sys.exit(nbdev_new())
File "/home/ndev_env/lib/python3.9/site-packages/fastcore/script.py", line 119, in _f
return tfunc(**merge(args, args_from_prog(func, xtra)))
File "/home/ndev_env/lib/python3.9/site-packages/nbdev/cli.py", line 108, in nbdev_new
nbdev_export.__wrapped__()
File "/home/ndev_env/lib/python3.9/site-packages/nbdev/doclinks.py", line 134, in nbdev_export
for f in files: nb_export(f)
File "/home/ndev_env/lib/python3.9/site-packages/nbdev/export.py", line 48, in nb_export
nb = NBProcessor(nbname, [exp]+L(procs), debug=debug)
File "/home/ndev_env/lib/python3.9/site-packages/nbdev/process.py", line 92, in __init__
self.nb = read_nb(path) if nb is None else nb
File "/home/ndev_env/lib/python3.9/site-packages/execnb/nbio.py", line 57, in read_nb
res = dict2nb(_read_json(path, encoding='utf-8'))
File "/home/ndev_env/lib/python3.9/site-packages/execnb/nbio.py", line 16, in _read_json
return loads(Path(self).read_text(encoding=encoding, errors=errors))
File "/home/ndev_env/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/home/ndev_env/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/ndev_env/lib/python3.9/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 19 column 41 (char 323)

The same error gets triggered when I try to export any notebooks within this project using the `nbdev_export` command. I saw [this issue](https://forums.fast.ai/t/nbdev-export-raises-jsondecodeerror/103606), but changing the python encoding environment variable doesn't work for me. I am running Linux.

Here is a [link](https://github.com/stroopwafl/toolformer/actions/runs/5599975826/jobs/10241683644) to the GitHub action for the failed test upon commit.

Has anyone seen or solved this before?

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with nbdev_new in a cloned empty repository, then inspect the generated notebook JSON around line 19 and trace the named entry points in nbdev/cli.py, nbdev/doclinks.py, nbdev/export.py, and execnb/nbio.py. The fix is complete when nbdev_new and nbdev_export run successfully on the reported project and the failed GitHub Action no longer raises JSONDecodeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.