sphinx-contrib/plantuml

Unfriendly error message when plantuml missing on Sphinx 2.0.1

software-opal opened this issue · 0 comments

Hey, I was trying to build some docs on my local machine which didn't have the PlantUML executable. Instead of getting a warning(or an error message explaining the problem) I got this cryptic error message:

Exception occurred:
  File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/plantuml.py", line 352, in _prepare_html_render
    self.builder.warn(str(err))
AttributeError: 'StandaloneHTMLBuilder' object has no attribute 'warn'
The full traceback has been saved in /tmp/sphinx-err-qt1j_qjl.log, if you want to report the issue to the developers.

Only after diving into the logs did I find the problem.

Contents of /tmp/sphinx-err-qt1j_qjl.log ``` # Sphinx version: 2.0.1 # Python version: 3.6.7 (CPython) # Docutils version: 0.14 # Jinja2 version: 2.10.1 # Last messages: # checking consistency... # # done # # preparing documents... # # done # # writing output... [ 50%] index # # Loaded extensions: # sphinx.ext.mathjax (2.0.1) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/ext/mathjax.py # sphinxcontrib.applehelp (1.0.1) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/applehelp/__init__.py # sphinxcontrib.devhelp (1.0.1) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/devhelp/__init__.py # sphinxcontrib.htmlhelp (1.0.2) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/htmlhelp/__init__.py # sphinxcontrib.serializinghtml (1.1.3) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/serializinghtml/__init__.py # sphinxcontrib.qthelp (1.0.2) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/qthelp/__init__.py # alabaster (0.7.12) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/alabaster/__init__.py # recommonmark (0.5.0) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/recommonmark/__init__.py # sphinx_markdown_tables () from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx_markdown_tables/__init__.py # sphinx.ext.autodoc (2.0.1) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/ext/autodoc/__init__.py # sphinx.ext.graphviz (2.0.1) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/ext/graphviz.py # sphinx.ext.ifconfig (2.0.1) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/ext/ifconfig.py # sphinx.ext.intersphinx (2.0.1) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/ext/intersphinx.py # sphinx.ext.todo (2.0.1) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/ext/todo.py # sphinx.ext.viewcode (2.0.1) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/ext/viewcode.py # sphinxcontrib.plantuml (unknown version) from /home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/plantuml.py Traceback (most recent call last): File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/plantuml.py", line 204, in render_plantuml cwd=absincdir) File "/usr/lib/python3.6/subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'plantuml': 'plantuml'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/plantuml.py", line 349, in _prepare_html_render
yield fileformats, gettag
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/plantuml.py", line 365, in html_visit_plantuml
for e in fileformats)
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/plantuml.py", line 365, in
for e in fileformats)
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/plantuml.py", line 209, in render_plantuml
% self.builder.config.plantuml)
sphinxcontrib.plantuml.PlantUmlError: plantuml command 'plantuml' cannot be run

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/cmd/build.py", line 284, in build_main
app.build(args.force_all, filenames)
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/application.py", line 337, in build
self.builder.build_update()
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/builders/init.py", line 326, in build_update
len(to_build))
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/builders/init.py", line 389, in build
self.write(docnames, list(updated_docnames), method)
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/builders/init.py", line 569, in write
self._write_serial(sorted(docnames))
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/builders/init.py", line 580, in _write_serial
self.write_doc(docname, doctree)
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/builders/html.py", line 644, in write_doc
self.docwriter.write(doctree, destination)
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/docutils/writers/init.py", line 80, in write
self.translate()
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinx/writers/html.py", line 59, in translate
self.document.walkabout(visitor)
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/docutils/nodes.py", line 166, in walkabout
visitor.dispatch_visit(self)
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/docutils/nodes.py", line 1882, in dispatch_visit
return method(node)
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/plantuml.py", line 365, in html_visit_plantuml
for e in fileformats)
File "/usr/lib/python3.6/contextlib.py", line 99, in exit
self.gen.throw(type, value, traceback)
File "/home/opal/.local/share/virtualenvs/docs-Wy3tOplJ/lib/python3.6/site-packages/sphinxcontrib/plantuml.py", line 352, in _prepare_html_render
self.builder.warn(str(err))
AttributeError: 'StandaloneHTMLBuilder' object has no attribute 'warn'

</details>