Skip to content

Regression in 7.4: jinja2.exceptions.TemplateNotFound error from jinja2glue #12593

@lucascolley

Description

@lucascolley

Describe the bug

x-ref pydata/pydata-sphinx-theme#1930


This started showing up in SciPy CI in the past day or so. x-ref scipy/scipy#21195.

Traceback (most recent call last):
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/events.py", line 98, in emit
    results.append(listener.handler(self.app, *args))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/pydata_sphinx_theme/__init__.py", line 189, in update_and_remove_templates
    context[section] = utils._update_and_remove_templates(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/pydata_sphinx_theme/utils.py", line 139, in _update_and_remove_templates
    rendered = app.builder.templates.render(template, ctx)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/jinja2glue.py", line 200, in render
    return self.environment.get_template(template).render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jinja2/environment.py", line 1013, in get_template
    return self._load_template(name, globals)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jinja2/environment.py", line 972, in _load_template
    template = self.loader.load(self, name, self.make_globals(globals))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/jinja2/loaders.py", line 126, in load
    source, filename, uptodate = self.get_source(environment, name)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/jinja2glue.py", line 222, in get_source
    raise TemplateNotFound(msg)
jinja2.exceptions.TemplateNotFound: 's.html' not found in ['/home/circleci/repo/doc/source/_templates', '/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/pydata_sphinx_theme/theme/pydata_sphinx_theme/components', '/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/pydata_sphinx_theme/theme/pydata_sphinx_theme', '/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/themes/basic']

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/cmd/build.py", line 337, in build_main
    app.build(args.force_all, args.filenames)
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/application.py", line 378, in build
    self.builder.build_update()
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 297, in build_update
    self.build(to_build,
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 367, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 614, in write
    self._write_serial(sorted(docnames))
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 624, in _write_serial
    self.write_doc(docname, doctree)
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/builders/html/__init__.py", line 666, in write_doc
    self.handle_page(docname, ctx, event_arg=doctree)
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/builders/html/__init__.py", line 1101, in handle_page
    newtmpl = self.app.emit_firstresult('html-page-context', pagename,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/application.py", line 515, in emit_firstresult
    return self.events.emit_firstresult(event, *args,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/events.py", line 124, in emit_firstresult
    for result in self.emit(name, *args, allowed_exceptions=allowed_exceptions):
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/events.py", line 109, in emit
    raise ExtensionError(
sphinx.errors.ExtensionError: Handler <function update_and_remove_templates at 0x7fad10c52a20> for event 'html-page-context' threw an exception (exception: 's.html' not found in ['/home/circleci/repo/doc/source/_templates', '/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/pydata_sphinx_theme/theme/pydata_sphinx_theme/components', '/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/pydata_sphinx_theme/theme/pydata_sphinx_theme', '/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/themes/basic'])

Extension error (pydata_sphinx_theme):
Handler <function update_and_remove_templates at 0x7fad10c52a20> for event 'html-page-context' threw an exception (exception: 's.html' not found in ['/home/circleci/repo/doc/source/_templates', '/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/pydata_sphinx_theme/theme/pydata_sphinx_theme/components', '/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/pydata_sphinx_theme/theme/pydata_sphinx_theme', '/home/circleci/.pyenv/versions/3.11.9/lib/python3.11/site-packages/sphinx/themes/basic'])
make: *** [Makefile:114: html-build] Error 2
Skipping build```

How to Reproduce

The line in PST looks to be app.builder.templates.render(template, ctx). Can look into this further if needed.

Environment Information

I don't have this info right now but we can look into it if needed.

Sphinx extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy