json.loads crashes in analyze_jsdoc
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 290
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
Hi, since v2.7.1 and in relation to #67 and https://github.com/erikrose/sphinx-js/commit/688b2a855b2a896a47cb9dd3a56d055bd16fdb2e, I get the following error. I'm on linux (mint 18.3) with python 3.5.
# Sphinx version: 1.8.2
# Python version: 3.5.2 (CPython)
# Docutils version: 0.14
# Jinja2 version: 2.10
# Last messages:
# Loaded extensions:
Traceback (most recent call last):
File "/home/thomas/.buildout/eggs/Sphinx-1.8.2-py3.5.egg/sphinx/cmd/build.py", line 303, in build_main
args.tags, args.verbosity, args.jobs, args.keep_going)
File "/home/thomas/.buildout/eggs/Sphinx-1.8.2-py3.5.egg/sphinx/application.py", line 263, in __init__
self._init_builder()
File "/home/thomas/.buildout/eggs/Sphinx-1.8.2-py3.5.egg/sphinx/application.py", line 325, in _init_builder
self.emit('builder-inited')
File "/home/thomas/.buildout/eggs/Sphinx-1.8.2-py3.5.egg/sphinx/application.py", line 510, in emit
return self.events.emit(event, self, *args)
File "/home/thomas/.buildout/eggs/Sphinx-1.8.2-py3.5.egg/sphinx/events.py", line 80, in emit
results.append(callback(*args))
File "/home/thomas/.buildout/eggs/sphinx_js-2.7.1-py3.5.egg/sphinx_js/doclets.py", line 29, in gather_doclets
doclets = analyze(abs_source_paths, app)
File "/home/thomas/.buildout/eggs/sphinx_js-2.7.1-py3.5.egg/sphinx_js/doclets.py", line 107, in analyze_jsdoc
return load(temp)
File "/usr/lib/python3.5/json/__init__.py", line 268, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
Not sure what the best way to handle this could be. Try and detect the locale, maybe?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in sphinx_js/doclets.py, especially analyze_jsdoc and the load(temp) call shown in the traceback. Reproduce the Sphinx build with Python 3.5 and the reported environment, then verify that the JSON-loading path handles the input without raising the bytes-versus-str error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100