I am using the Python MkDocs tool to build API documentation extracted directly from the source using the MkDocs mkdocstrings extension.
When I run the mkdocs serve
command inside my project (in the directory which contains the mkdocs.yml
file), the command fails with a ERROR - Could not collect 'cpinotify'
error.
aUser@aMachine:~/notify2nats$ mkdocs serve
INFO - Building documentation...
INFO - Cleaning site directory
ERROR - mkdocstrings.extension: Error while loading JSON:
Traceback (most recent call last):
File
"/home/aUser/.local/pipx/venvs/mkdocs/lib/python3.9/site-packages/mkdocstrings/handlers/python.py",
line 206, in collect
result = json.loads(stdout)
File
"/home/aUser/.asdf/installs/python/3.9.6/lib/python3.9/json/__init__.py",
line 346, in loads
return _default_decoder.decode(s)
File
"/home/aUser/.asdf/installs/python/3.9.6/lib/python3.9/json/decoder.py",
line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File
"/home/aUser/.asdf/installs/python/3.9.6/lib/python3.9/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)
ERROR - Error reading page 'API.md':
ERROR - Could not collect 'cpinotify'
Aborted with a BuildError!
My docs/API.md
file which contains the MkDocs mkdocstrings command is:
# Test
::: cpinotify
(Where cpinotify
is the name of the Python package from which the mkdocstrings documentation is to be extracted).
Versions:
- Python v3.9.6
- MkDocs v1.2.2
- mkdocstrings v0.15.2
- Ubuntu 20.04
- asdf v0.8.1-a1ef92a (to virtualize Python versions)
- pipx v0.16.3 (to virtualize installed Python packages/commands)