readthedocs.org: Build Failing with ``AttributeError: 'NoneType' object has no attribute 'traverse'``

Details

Expected Result

A description of what you wanted to happen Successful docs build

Actual Result

A description of what actually happened Build errors with AttributeError: 'NoneType' object has no attribute 'traverse'

Sphinx versions tried:

1.4.5, 1.4.6

Summary

The build fails with the traceback shown below.

Honestly, I’m not sure if this is a sphinx issue or an rtd issue, but it doesn’t happen when I build the docs locally.

I’m not sure why it’s trying to assemble a single document, because this project is not configured to be built as single page html.

Traceback:

Running Sphinx v1.4.5
making output directory...
loading translations [en]... done
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [readthedocssinglehtmllocalmedia]: all documents
updating environment: 8 added, 0 changed, 0 removed
reading sources... [ 12%] README
reading sources... [ 25%] docs/includes/examples/README
reading sources... [ 37%] docs/includes/examples/concept_what-is-guacamole
reading sources... [ 50%] docs/includes/examples/concept_what-is-salsa
reading sources... [ 62%] docs/includes/examples/ref_ingredients-guac
reading sources... [ 75%] docs/includes/examples/ref_ingredients-salsa
reading sources... [ 87%] docs/includes/examples/topic_make-guacamole
reading sources... [100%] docs/includes/examples/topic_make-salsa

/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/checkouts/latest/docs/includes/examples/ref_ingredients-salsa.rst:5: WARNING: duplicate label ingredients, other instance in /home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/checkouts/latest/docs/includes/examples/ref_ingredients-guac.rst
/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/checkouts/latest/docs/includes/examples/topic_make-salsa.rst:5: WARNING: duplicate label steps, other instance in /home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/checkouts/latest/docs/includes/examples/topic_make-guacamole.rst
looking for now-outdated files... none found
pickling environment... done
checking consistency... /home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/checkouts/latest/docs/includes/examples/README.rst:: WARNING: document isn't included in any toctree
done
preparing documents... done
assembling single document... 
writing... 
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/cmdline.py", line 244, in main
    app.build(opts.force_all, filenames)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/application.py", line 297, in build
    self.builder.build_update()
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 246, in build_update
    self.build(['__all__'], to_build)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 322, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/html.py", line 1023, in write
    self.write_doc(self.config.master_doc, doctree)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/html.py", line 452, in write_doc
    self.handle_page(docname, ctx, event_arg=doctree)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/html.py", line 803, in handle_page
    output = self.templates.render(templatename, ctx)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/readthedocs_ext/readthedocs.py", line 101, in rtd_render
    content = old_render(template, render_context)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/jinja2glue.py", line 138, in render
    return self.environment.get_template(template).render(context)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/themes/basic/page.html", line 10, in top-level template code
    {%- extends "layout.html" %}
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx_rtd_theme/layout.html", line 122, in top-level template code
    {% block menu %}
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx_rtd_theme/layout.html", line 123, in block "menu"
    {% set toctree = toctree(maxdepth=4, collapse=theme_collapse_navigation, includehidden=True) %}
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/jinja2/sandbox.py", line 355, in call
    return __context.call(__obj, *args, **kwargs)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/html.py", line 793, in <lambda>
    ctx['toctree'] = lambda **kw: self._get_local_toctree(pagename, **kw)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/html.py", line 955, in _get_local_toctree
    self.fix_refuris(toctree)
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/html.py", line 940, in fix_refuris
    for refnode in tree.traverse(nodes.reference):
AttributeError: 'NoneType' object has no attribute 'traverse'

Exception occurred:
  File "/home/docs/checkouts/readthedocs.org/user_builds/f5-docs-training/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/html.py", line 940, in fix_refuris
    for refnode in tree.traverse(nodes.reference):
AttributeError: 'NoneType' object has no attribute 'traverse'
The full traceback has been saved in /tmp/sphinx-err-xO2X99.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!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 24 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@da4089 Same, I’m seeing this same error on Read the Docs. Locally, using Sphinx (1.6.4) build works, but I’m getting this error on RTD, which uses sphinx version 1.5.3.

To require RTD to use sphinx >= 1.6.0, I used a yaml file and a requirements.txt as seen in this commit: https://github.com/NCBI-Hackathons/Tumor_sim/commit/4c28466329a31e8020f659ac77b42f065209d918 . This resolved the error.

Huzzah! I released (several) versions of our theme today. The latest release seems to resolve this issue. @nichtich i tested against your repo, anyone else having trouble with this still after a fresh build?

This is caused by an empty toctree in your project. It’s a Sphinx bug, but by not having an empty TOC Tree, it should be fixed.