bintoro / sphinx-navtree

Navigation tree customization for Sphinx
MIT License
4 stars 3 forks source link

Build Fail - 'BuildEnvironment' object has no attribute '_toctree_prune' #1

Open gtalarico opened 6 years ago

gtalarico commented 6 years ago
Exception occurred:
  File "c:\users\gtalarico\.env\rpw\lib\site-packages\sphinx_navtree\main.py", line 105, in process_toctree_list
    app.env._toctree_prune(node     = list_item,
AttributeError: 'BuildEnvironment' object has no attribute '_toctree_prune'
The full traceback has been saved in c:\users\gtalar~1\appdata\local\temp\sphinx-err-6ap6ui.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!
fredbi commented 6 years ago

Hello I have the same issue: python 2.1.14 (Windows build), Sphinx 1.6.4, using RTD theme/

conf.py options:

navtree_shift = True
navtree_root_links = True
navtree_maxdepth = { 'default': 1 }

Got stack:

# Sphinx version: 1.6.4
# Python version: 2.7.14 (CPython)
# Docutils version: 0.14 
# Jinja2 version: 2.9.6
# Last messages:
#   
#   looking for now-outdated files...
#   none found
#   pickling environment...
#   done
#   checking consistency...
#   done
#   preparing documents...
#   done
#   writing output... [  2%] am/amdummies
# Loaded extensions:
#   sphinxjsondomain (unknown version) from D:\python27\lib\site-packages\sphinxjsondomain.pyc
#   sphinx_navtree (unknown version) from D:\python27\lib\site-packages\sphinx_navtree-0.3.0-py2.7.egg\sphinx_navtree\__init__.pyc
#   sphinx.ext.mathjax (1.6.4) from D:\python27\lib\site-packages\sphinx\ext\mathjax.pyc
#   sphinx-jsonschema (1.4) from D:\python27\lib\site-packages\sphinx_jsonschema-1.4-py2.7.egg\sphinx-jsonschema\__init__.pyc
#   sphinx.ext.viewcode (1.6.4) from D:\python27\lib\site-packages\sphinx\ext\viewcode.pyc
#   sphinxcontrib.actdiag (0.5.4) from d:\python27\lib\site-packages\sphinxcontrib_actdiag-0.8.5-py2.7.egg\sphinxcontrib\actdiag.pyc
#   sphinxcontrib_yaml (1.6.4) from D:\python27\lib\site-packages\sphinxcontrib_yaml-1.0.0-py2.7.egg\sphinxcontrib_yaml.pyc
#   sphinx.ext.todo (1.6.4) from D:\python27\lib\site-packages\sphinx\ext\todo.pyc
#   sphinxcontrib.seqdiag (0.9.5) from d:\python27\lib\site-packages\sphinxcontrib_seqdiag-0.8.5-py2.7.egg\sphinxcontrib\seqdiag.pyc
#   sphinxcontrib.nwdiag (1.0.4) from d:\python27\lib\site-packages\sphinxcontrib_nwdiag-0.9.5-py2.7.egg\sphinxcontrib\nwdiag.pyc
#   sphinx.ext.graphviz (1.6.4) from D:\python27\lib\site-packages\sphinx\ext\graphviz.pyc
#   alabaster (0.7.10) from D:\python27\lib\site-packages\alabaster-0.7.10-py2.7.egg\alabaster\__init__.pyc
#   sphinxcontrib.blockdiag (1.5.3) from d:\python27\lib\site-packages\sphinxcontrib_blockdiag-1.5.5-py2.7.egg\sphinxcontrib\blockdiag.pyc
#   sphinxcontrib.redoc (1.3.0) from d:\python27\lib\site-packages\sphinxcontrib\redoc.pyc
#   sphinxcontrib.visio (2.1.2) from d:\python27\lib\site-packages\sphinxcontrib\visio.pyc
#   hieroglyph (unknown version) from D:\python27\lib\site-packages\hieroglyph\__init__.pyc
Traceback (most recent call last):
  File "D:\python27\lib\site-packages\sphinx\cmdline.py", line 306, in main
    app.build(opts.force_all, filenames)
  File "D:\python27\lib\site-packages\sphinx\application.py", line 339, in build
    self.builder.build_update()
  File "D:\python27\lib\site-packages\sphinx\builders\__init__.py", line 331, in build_update
    'out of date' % len(to_build))
  File "D:\python27\lib\site-packages\sphinx\builders\__init__.py", line 397, in build
    self.write(docnames, list(updated_docnames), method)
  File "D:\python27\lib\site-packages\sphinx\builders\__init__.py", line 434, in write
    self._write_serial(sorted(docnames))
  File "D:\python27\lib\site-packages\sphinx\builders\__init__.py", line 443, in _write_serial
    self.write_doc(docname, doctree)
  File "D:\python27\lib\site-packages\sphinx\builders\html.py", line 561, in write_doc
    self.handle_page(docname, ctx, event_arg=doctree)
  File "D:\python27\lib\site-packages\sphinx\builders\html.py", line 951, in handle_page
    output = self.templates.render(templatename, ctx)
  File "D:\python27\lib\site-packages\sphinx\jinja2glue.py", line 176, in render
    return self.environment.get_template(template).render(context)
  File "D:\python27\lib\site-packages\jinja2-2.9.6-py2.7.egg\jinja2\environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "D:\python27\lib\site-packages\jinja2-2.9.6-py2.7.egg\jinja2\environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "D:\python27\lib\site-packages\sphinx\themes\basic\page.html", line 10, in top-level template code
    {%- extends "layout.html" %}
  File "D:\python27\lib\site-packages\sphinx_rtd_theme\layout.html", line 127, in top-level template code
    {% block menu %}
  File "D:\python27\lib\site-packages\sphinx_rtd_theme\layout.html", line 133, in block "menu"
    {% set global_toc = toctree(maxdepth=theme_navigation_depth|int, collapse=theme_collapse_navigation, includehidden=True) %}
  File "D:\python27\lib\site-packages\jinja2-2.9.6-py2.7.egg\jinja2\sandbox.py", line 427, in call
    return __context.call(__obj, *args, **kwargs)
  File "D:\python27\lib\site-packages\sphinx_navtree-0.3.0-py2.7.egg\sphinx_navtree\main.py", line 35, in <lambda>
    context[app.config.navtree_template_var] = lambda **options: get_navtree(app, pagename, **options)
  File "D:\python27\lib\site-packages\sphinx_navtree-0.3.0-py2.7.egg\sphinx_navtree\main.py", line 54, in get_navtree
    collapse, maxdepth, shift_toc, root_links)
  File "D:\python27\lib\site-packages\sphinx_navtree-0.3.0-py2.7.egg\sphinx_navtree\main.py", line 105, in process_toctree_list
    app.env._toctree_prune(node     = list_item,
AttributeError: 'BuildEnvironment' object has no attribute '_toctree_prune'
Frabjous2001 commented 5 years ago

The problem appears to be that the Sphinx API has changed. The command in question (env.get_toctree_for) is deprecated and you're supposed to use the new one: sphinx.environment.adapters.toctre.TocTree.

tsteinholz commented 4 years ago

I am seeing the same thing...

Theme error:
An error happened in rendering the page conductor.
Reason: AttributeError("'BuildEnvironment' object has no attribute 'get_toctree_for'")
make: *** [html] Error 2
AraHaan commented 3 years ago

AttributeError: 'BuildEnvironment' object has no attribute 'note_versionchange' for me.