sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.45k stars 2.1k forks source link

AttributeError: 'Values' object has no attribute 'tab_width #9049

Closed probonopd closed 3 years ago

probonopd commented 3 years ago
+ make html
Running Sphinx v3.5.3
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 51 source files that are out of date
updating environment: [new config] 51 added, 0 changed, 0 removed
reading sources... [  1%] developer/acknowledgements
reading sources... [  3%] developer/application-bundles
/usr/local/lib/python3.8/dist-packages/recommonmark/parser.py:75: UserWarning: Container node skipped: type=document
  warn("Container node skipped: type={0}".format(mdnode.t))

Exception occurred:
  File "/usr/local/lib/python3.8/dist-packages/docutils/parsers/rst/__init__.py", line 193, in parse
    inputstring, tab_width=document.settings.tab_width,
AttributeError: 'Values' object has no attribute 'tab_width'
The full traceback has been saved in /tmp/sphinx-err-2f_3sdun.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
tk0miya commented 3 years ago

Could you share the full traceback, please?

zmey3301 commented 3 years ago

Having the same problem with the 0.17, looks like 0.13.1 regression (1, 2). Pinning 0.16 fixes this.

zmey3301 commented 3 years ago

Full traceback:


# Python version: 3.7.10 (CPython)
# Docutils version: 0.17 release
# Jinja2 version: 2.11.3
# Last messages:
#   building [html]: targets for 19 source files that are out of date
#   updating environment:
#   [new config]
#   19 added, 0 changed, 0 removed
#   reading sources... [  5%] api/billing
#   reading sources... [ 10%] api/index
#   reading sources... [ 15%] api/sockets
#   reading sources... [ 21%] changelog
#   reading sources... [ 26%] development/billing
#   reading sources... [ 31%] development/cicd
# Loaded extensions:
#   sphinx.ext.mathjax (3.5.3) from /usr/local/lib/python3.7/site-packages/sphinx/ext/mathjax.py
#   sphinxcontrib.applehelp (1.0.2) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/applehelp/__init__.py
#   sphinxcontrib.devhelp (1.0.2) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/devhelp/__init__.py
#   sphinxcontrib.htmlhelp (1.0.3) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/htmlhelp/__init__.py
#   sphinxcontrib.serializinghtml (1.1.4) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/serializinghtml/__init__.py
#   sphinxcontrib.qthelp (1.0.3) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/qthelp/__init__.py
#   alabaster (0.7.12) from /usr/local/lib/python3.7/site-packages/alabaster/__init__.py
#   recommonmark (0.7.1) from /usr/local/lib/python3.7/site-packages/recommonmark/__init__.py
#   sphinx_markdown_tables (<module 'sphinx_markdown_tables.__version__' from '/usr/local/lib/python3.7/site-packages/sphinx_markdown_tables/__version__.py'>) from /usr/local/lib/python3.7/site-packages/sphinx_markdown_tables/__init__.py
#   sphinxcontrib.httpdomain (unknown version) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/httpdomain.py
#   sphinxcontrib.openapi (None) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/openapi/__init__.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sphinx/cmd/build.py", line 280, in build_main
    app.build(args.force_all, filenames)
  File "/usr/local/lib/python3.7/site-packages/sphinx/application.py", line 352, in build
    self.builder.build_update()
  File "/usr/local/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 298, in build_update
    len(to_build))
  File "/usr/local/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 310, in build
    updated_docnames = set(self.read())
  File "/usr/local/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 417, in read
    self._read_serial(docnames)
  File "/usr/local/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 438, in _read_serial
    self.read_doc(docname)
  File "/usr/local/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 478, in read_doc
    doctree = read_doc(self.app, self.env, self.env.doc2path(docname))
  File "/usr/local/lib/python3.7/site-packages/sphinx/io.py", line 221, in read_doc
    pub.publish()
  File "/usr/local/lib/python3.7/site-packages/docutils/core.py", line 219, in publish
    self.apply_transforms()
  File "/usr/local/lib/python3.7/site-packages/docutils/core.py", line 200, in apply_transforms
    self.document.transformer.apply_transforms()
  File "/usr/local/lib/python3.7/site-packages/sphinx/transforms/__init__.py", line 86, in apply_transforms
    super().apply_transforms()
  File "/usr/local/lib/python3.7/site-packages/docutils/transforms/__init__.py", line 171, in apply_transforms
    transform.apply(**kwargs)
  File "/usr/local/lib/python3.7/site-packages/recommonmark/transform.py", line 333, in apply
    self.traverse(self.document)
  File "/usr/local/lib/python3.7/site-packages/recommonmark/transform.py", line 313, in traverse
    self.traverse(child)
  File "/usr/local/lib/python3.7/site-packages/recommonmark/transform.py", line 313, in traverse
    self.traverse(child)
  File "/usr/local/lib/python3.7/site-packages/recommonmark/transform.py", line 303, in traverse
    newnode = self.find_replace(c)
  File "/usr/local/lib/python3.7/site-packages/recommonmark/transform.py", line 285, in find_replace
    newnode = self.auto_code_block(node)
  File "/usr/local/lib/python3.7/site-packages/recommonmark/transform.py", line 259, in auto_code_block
    parser.parse(newsource, new_doc)
  File "/usr/local/lib/python3.7/site-packages/docutils/parsers/rst/__init__.py", line 193, in parse
    inputstring, tab_width=document.settings.tab_width,
AttributeError: 'Values' object has no attribute 'tab_width'
probonopd commented 3 years ago

Pinning 0.16 fixes this.

I confirm. pip3 install docutils==0.16 sphinx ... worked for me. Thanks @zmey3301

tk0miya commented 3 years ago

Thank you for the info. It seems the error happened inside the recommonmark extension. I guess this is a bug of it. The tab_width entry is needed for the settings_spec of the recommonmark parser. Please report this into their project. Thanks,