fastai / nbdev

Create delightful software with Jupyter Notebooks
https://nbdev.fast.ai/
Apache License 2.0
4.9k stars 487 forks source link

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

Open superolly opened 1 year ago

superolly commented 1 year ago

On creating a new nbdev project with the nbdev_new command, after cloning into an empty git repo as described in the tutorial, 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, but changing the python encoding environment variable doesn't work for me. I am running Linux.

Here is a link to the GitHub action for the failed test upon commit.

Has anyone seen or solved this before?

nicole-brewer commented 6 months ago

I had this problem also. I used the solution provided in #1278 . My problem was that my description contains double quotes and my solution was to delete the files generated by nbdev_new and run nbdev_new again, this time without the use of any quotes in the description.