Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2.0.0b1] TemplateNotFound #6186

Closed
JulienPalard opened this issue Mar 18, 2019 · 10 comments
Closed

[v2.0.0b1] TemplateNotFound #6186

JulienPalard opened this issue Mar 18, 2019 · 10 comments
Labels
Milestone

Comments

@JulienPalard
Copy link
Contributor

JulienPalard commented Mar 18, 2019

Hi!

Whild building cpython documentation for cpython 2.7 with sphinx 2.0.0b1 I'm having a TemplateNotFound error without any other indication.

Breaking in the code helps me a bit, it's a page.html that is missing.

cc @tk0miya not sure if the issue is my side or sphinx side but as we're near the 2.0.0 release I prefer mentionning you on this issue.

To Reproduce

$ git clone https://github.com/python/cpython/
$ cd cpython/Doc
$ git checkout 2.7
$ pip install blurb python-docs-theme
$ pip install --pre sphinx
$ make autobuild-dev-html

see at the end:

writing additional pages... download index
Theme error:
An error happened in rendering the page index.
Reason: TemplateNotFound()

Expected behavior
No build error OR a verbose message.

Environment info

  • OS: Debian testing
  • Python version: 3.7.2
  • Sphinx version: 2.0.0b1

More info
With v1.8.5 it works.

Stacktrace:

  /home/mdk/.venvs/sphinx-build-2.0.0b1/bin/sphinx-build(11)<module>()
-> load_entry_point('Sphinx', 'console_scripts', 'sphinx-build')()
  /home/mdk/clones/sphinx/sphinx/cmd/build.py(299)main()
-> return build_main(argv)
  /home/mdk/clones/sphinx/sphinx/cmd/build.py(284)build_main()
-> app.build(args.force_all, filenames)
  /home/mdk/clones/sphinx/sphinx/application.py(338)build()
-> self.builder.build_update()
  /home/mdk/clones/sphinx/sphinx/builders/__init__.py(326)build_update()
-> len(to_build))
  /home/mdk/clones/sphinx/sphinx/builders/__init__.py(392)build()
-> self.finish()
  /home/mdk/clones/sphinx/sphinx/builders/html.py(665)finish()
-> self.finish_tasks.add_task(self.gen_additional_pages)
  /home/mdk/clones/sphinx/sphinx/util/parallel.py(47)add_task()
-> res = task_func()
  /home/mdk/clones/sphinx/sphinx/builders/html.py(700)gen_additional_pages()
-> self.handle_page(pagename, {}, template)
  /home/mdk/clones/sphinx/sphinx/builders/html.py(1092)handle_page()
-> output = self.templates.render(templatename, ctx)
  /home/mdk/clones/sphinx/sphinx/jinja2glue.py(207)render()
-> return self.environment.get_template(template).render(context)
  /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/jinja2/asyncsupport.py(76)render()
-> return original_render(self, *args, **kwargs)
  /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/jinja2/environment.py(1005)render()
-> return concat(self.root_render_func(self.new_context(vars)))
  /home/mdk/clones/cpython/Doc/tools/templates/indexcontent.html(14)root()
-> <span class="linkdescr">{% trans whatsnew_index=pathto("whatsnew/index") %}or <a href="{{ whatsnew_index }}">all "What's new" documents</a> since 2.0{% endtrans %}</span></p>
  /home/mdk/clones/cpython/Doc/tools/templates/layout.html(14)root()
-> </li>
  /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/python_docs_theme/layout.html(38)root()
-> {% block extrahead %}
  /home/mdk/clones/sphinx/sphinx/themes/classic/layout.html(14)root()
-> {% if theme_collapsiblesidebar|tobool %}
  /home/mdk/clones/sphinx/sphinx/themes/basic/layout.html(293)root()
  /home/mdk/clones/sphinx/sphinx/themes/basic/layout.html(500)block_content()
  /home/mdk/clones/sphinx/sphinx/themes/basic/layout.html(541)block_sidebar2()
  /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/jinja2/sandbox.py(427)call()
-> return __context.call(__obj, *args, **kwargs)
  /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/jinja2/runtime.py(262)call()
-> return __obj(*args, **kwargs)
  /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/jinja2/runtime.py(575)__call__()
-> return self._invoke(arguments, autoescape)
  /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/jinja2/asyncsupport.py(110)_invoke()
-> return original_invoke(self, arguments, autoescape)
  /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/jinja2/runtime.py(579)_invoke()
-> rv = self._func(*arguments)
  /home/mdk/clones/sphinx/sphinx/themes/basic/layout.html(158)macro()
-> {%- if next %}
  /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/jinja2/environment.py(869)get_or_select_template()
-> return self.get_template(template_name_or_list, parent, globals)
  /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/jinja2/environment.py(830)get_template()
-> return self._load_template(name, self.make_globals(globals))
  /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/jinja2/environment.py(804)_load_template()
-> template = self.loader.load(self, name, globals)
  /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/jinja2/loaders.py(113)load()
-> source, filename, uptodate = self.get_source(environment, name)
> /home/mdk/clones/sphinx/sphinx/jinja2glue.py(236)get_source()
-> raise TemplateNotFound(template)
(Pdb) args
self = <sphinx.jinja2glue.BuiltinTemplateLoader object at 0x7f8e08ff2898>
environment = <jinja2.sandbox.SandboxedEnvironment object at 0x7f8e08ff2860>
template = 'i'

Exploring the stacktrace near if next I'm seeing:

> /home/mdk/clones/sphinx/sphinx/themes/basic/layout.html(158)macro()
-> {%- if next %}
(Pdb) down
> /home/mdk/.venvs/sphinx-build-2.0.0b1/lib/python3.7/site-packages/jinja2/environment.py(869)get_or_select_template()
-> return self.get_template(template_name_or_list, parent, globals)
(Pdb) args
self = <jinja2.sandbox.SandboxedEnvironment object at 0x7f53794ad710>
template_name_or_list = 'i'
parent = 'basic/layout.html'
globals = None

In the {%- if next %} context I'm seeing:

 'l_2_sidebartemplate': 'i',

OK so this is:

warnings.warn('Now html_sidebars only allows list of sidebar '
              'templates as a value. Support for a string value '
              'will be removed at Sphinx-2.0.',
              RemovedInSphinx20Warning, stacklevel=2)

So this just have to be documented in the CHANGES files, in the Incompatible changes section.

@JulienPalard
Copy link
Contributor Author

About the message not being vebose enough (just TemplateNotFound()) I opened: pallets/jinja#961

@tk0miya
Copy link
Member

tk0miya commented Mar 18, 2019

Is this caused by string value in html_sidebars? If true, it's not a new change. We announced the change about html_sidebars at 1.7.0b1 release.

sphinx/CHANGES

Lines 1089 to 1095 in 42c8fbd

Deprecated
----------
1.7.0b1
* using a string value for :confval:`html_sidebars` is deprecated and only list
values will be accepted at 2.0.

@JulienPalard
Copy link
Contributor Author

Yes but when I'm upgrading a project from 1.8.5 to 2.0.0 I'm not reading the 1.7.0b1 changelog :]

@tk0miya
Copy link
Member

tk0miya commented Mar 18, 2019

Should we mention the deprecated feature also on removal? We'll drop all deprecations in 1.7.x series on next major release.

@JulienPalard
Copy link
Contributor Author

JulienPalard commented Mar 18, 2019

I think so, like I propose in #6187 (don't know if there are others), to be sure people just reading the release changes (like I did) get it right. Also because this one (due to the Jinja2 error message not being comprehensive enough) is really tricky to diagnose.

@tk0miya
Copy link
Member

tk0miya commented Mar 18, 2019

Hmm... it means nobody reads "deprecated" section and command line warnings...

@tk0miya tk0miya added this to the 2.0.0 milestone Mar 18, 2019
@JulienPalard
Copy link
Contributor Author

Yes, the sad reality :(

But I have an excuse \o/ my "command line warnings" are scattered into 31 logs files, producing 4068066 lines of log daily (thanks to latex warning mainly), so I only read them when really needed. But yes that's sad I didn't spotted the RemovedInSphinx20Warning: Now html_sidebars only allows list of sidebar templates as a value. Support for a string value will be removed at Sphinx-2.0..

For the Sphinx 2 upgrade I read the CHANGES file today (but I expect almost nobody does it), but only the 2.0 section, not mentionning html_sidebar þ

@tk0miya
Copy link
Member

tk0miya commented Mar 21, 2019

In 2.0.0, we'll mark large amount of code as deprecated. It means they will be removed in future version (maybe in 4.0.0). I feel copying them to CHANGES on future version is annoying.

sphinx/CHANGES

Lines 174 to 257 in e6cc18c

Deprecated
----------
* Support for evaluating Python 2 syntax is deprecated. This includes
configuration files which should be converted to Python 3.
* The arguments of ``EpubBuilder.build_mimetype()``,
``EpubBuilder.build_container()``, ``EpubBuilder.bulid_content()``,
``EpubBuilder.build_toc()`` and ``EpubBuilder.build_epub()``
* The arguments of ``Epub3Builder.build_navigation_doc()``
* The config variables
- :confval:`html_experimental_html5_writer`
* The ``encoding`` argument of ``autodoc.Documenter.get_doc()``,
``autodoc.DocstringSignatureMixin.get_doc()``,
``autodoc.DocstringSignatureMixin._find_signature()``, and
``autodoc.ClassDocumenter.get_doc()`` are deprecated.
* The ``importer`` argument of ``sphinx.ext.autodoc.importer._MockModule``
* The ``nodetype`` argument of ``sphinx.search.WordCollector.
is_meta_keywords()``
* The ``suffix`` argument of ``env.doc2path()`` is deprecated.
* The string style ``base`` argument of ``env.doc2path()`` is deprecated.
* The fallback to allow omitting the ``filename`` argument from an overridden
``IndexBuilder.feed()`` method is deprecated.
* ``sphinx.addnodes.abbreviation``
* ``sphinx.application.Sphinx._setting_up_extension``
* ``sphinx.builders.epub3.Epub3Builder.validate_config_value()``
* ``sphinx.builders.html.SingleFileHTMLBuilder``
* ``sphinx.builders.htmlhelp.HTMLHelpBuilder.open_file()``
* ``sphinx.cmd.quickstart.term_decode()``
* ``sphinx.cmd.quickstart.TERM_ENCODING``
* ``sphinx.config.check_unicode()``
* ``sphinx.config.string_classes``
* ``sphinx.domains.cpp.DefinitionError.description``
* ``sphinx.domains.cpp.NoOldIdError.description``
* ``sphinx.domains.cpp.UnsupportedMultiCharacterCharLiteral.decoded``
* ``sphinx.ext.autodoc.importer._MockImporter``
* ``sphinx.ext.autosummary.Autosummary.warn()``
* ``sphinx.ext.autosummary.Autosummary.genopt``
* ``sphinx.ext.autosummary.Autosummary.warnings``
* ``sphinx.ext.autosummary.Autosummary.result``
* ``sphinx.ext.doctest.doctest_encode()``
* ``sphinx.io.SphinxBaseFileInput``
* ``sphinx.io.SphinxFileInput.supported``
* ``sphinx.io.SphinxRSTFileInput``
* ``sphinx.registry.SphinxComponentRegistry.add_source_input()``
* ``sphinx.roles.abbr_role()``
* ``sphinx.roles.emph_literal_role()``
* ``sphinx.roles.menusel_role()``
* ``sphinx.roles.index_role()``
* ``sphinx.roles.indexmarkup_role()``
* ``sphinx.testing.util.remove_unicode_literal()``
* ``sphinx.util.attrdict``
* ``sphinx.util.force_decode()``
* ``sphinx.util.get_matching_docs()``
* ``sphinx.util.inspect.Parameter``
* ``sphinx.util.jsonimpl``
* ``sphinx.util.osutil.EEXIST``
* ``sphinx.util.osutil.EINVAL``
* ``sphinx.util.osutil.ENOENT``
* ``sphinx.util.osutil.EPIPE``
* ``sphinx.util.osutil.walk()``
* ``sphinx.util.PeekableIterator``
* ``sphinx.util.pycompat.NoneType``
* ``sphinx.util.pycompat.TextIOWrapper``
* ``sphinx.util.pycompat.UnicodeMixin``
* ``sphinx.util.pycompat.htmlescape``
* ``sphinx.util.pycompat.indent``
* ``sphinx.util.pycompat.sys_encoding``
* ``sphinx.util.pycompat.terminal_safe()``
* ``sphinx.util.pycompat.u``
* ``sphinx.writers.latex.ExtBabel``
* ``sphinx.writers.latex.LaTeXTranslator._make_visit_admonition()``
* ``sphinx.writers.latex.LaTeXTranslator.babel_defmacro()``
* ``sphinx.writers.latex.LaTeXTranslator.collect_footnotes()``
* ``sphinx.writers.latex.LaTeXTranslator.generate_numfig_format()``
* ``sphinx.writers.texinfo.TexinfoTranslator._make_visit_admonition()``
* ``sphinx.writers.text.TextTranslator._make_depart_admonition()``
* template variables for LaTeX template
- ``logo``
- ``numfig_format``
- ``pageautorefname``
- ``translatablestrings``

How about adding an entry like "Drop features deprecated in 1.7.x " instead?

@JulienPalard
Copy link
Contributor Author

Drop features deprecated in 1.7.x LGTM

tk0miya added a commit to tk0miya/sphinx that referenced this issue Mar 23, 2019
tk0miya added a commit to tk0miya/sphinx that referenced this issue Mar 23, 2019
tk0miya added a commit that referenced this issue Mar 23, 2019
Add an incompatible change entry (refs: #6186)
@tk0miya
Copy link
Member

tk0miya commented Mar 23, 2019

done n #6195.
Thank you for comment!

@tk0miya tk0miya closed this as completed Mar 23, 2019
zmodem added a commit to llvm/llvm-project that referenced this issue Aug 20, 2020
Otherwise the docs-lld-html target fails to build using recent Sphinx
with the following not very helpful error message:

An error happened in rendering the page index.
Reason: TemplateNotFound()

It turns out the values in the html_sidebars dictionary always need to be lists
now. See sphinx-doc/sphinx#6186
zmodem added a commit to llvm/llvm-project that referenced this issue Aug 20, 2020
Otherwise the docs-lld-html target fails to build using recent Sphinx
with the following not very helpful error message:

An error happened in rendering the page index.
Reason: TemplateNotFound()

It turns out the values in the html_sidebars dictionary always need to be lists
now. See sphinx-doc/sphinx#6186
arichardson pushed a commit to arichardson/llvm-project that referenced this issue Mar 22, 2021
Otherwise the docs-lld-html target fails to build using recent Sphinx
with the following not very helpful error message:

An error happened in rendering the page index.
Reason: TemplateNotFound()

It turns out the values in the html_sidebars dictionary always need to be lists
now. See sphinx-doc/sphinx#6186
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants