Skip to content

sphinx-autogen crashes with jinja2.exceptions.UndefinedError #7536

@tk0miya

Description

@tk0miya

Describe the bug
sphinx-autogen crashes with jinja2.exceptions.UndefinedError

To Reproduce

$ sphinx-autogen example.py
[autosummary] example.py の autosummary を生成中
Traceback (most recent call last):
  File "/Users/tkomiya/work/tmp/bin/sphinx-autogen", line 11, in <module>
    load_entry_point('Sphinx', 'console_scripts', 'sphinx-autogen')()
  File "/Users/tkomiya/work/sphinx/sphinx/ext/autosummary/generate.py", line 517, in main
    generate_autosummary_docs(args.source_file, args.output_dir,
  File "/Users/tkomiya/work/sphinx/sphinx/ext/autosummary/generate.py", line 304, in generate_autosummary_docs
    content = generate_autosummary_content(name, obj, parent, template, entry.template,
  File "/Users/tkomiya/work/sphinx/sphinx/ext/autosummary/generate.py", line 245, in generate_autosummary_content
    return template.render(template_name, ns)
  File "/Users/tkomiya/work/sphinx/sphinx/ext/autosummary/generate.py", line 144, in render
    return self.env.get_template(template_name).render(context)
  File "/Users/tkomiya/.pyenv/versions/3.8.1/lib/python3.8/site-packages/Jinja2-3.0.0a1-py3.8.egg/jinja2/environment.py", line 1045, in render
    self.environment.handle_exception()
  File "/Users/tkomiya/.pyenv/versions/3.8.1/lib/python3.8/site-packages/Jinja2-3.0.0a1-py3.8.egg/jinja2/environment.py", line 787, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/Users/tkomiya/work/sphinx/sphinx/ext/autosummary/templates/autosummary/module.rst", line 5, in top-level template code
    {% block functions %}
  File "/Users/tkomiya/work/sphinx/sphinx/ext/autosummary/templates/autosummary/module.rst", line 7, in block 'functions'
    .. rubric:: {{ _('Functions') }}
  File "/Users/tkomiya/.pyenv/versions/3.8.1/lib/python3.8/site-packages/Jinja2-3.0.0a1-py3.8.egg/jinja2/sandbox.py", line 410, in call
    if not __self.is_safe_callable(__obj):
  File "/Users/tkomiya/.pyenv/versions/3.8.1/lib/python3.8/site-packages/Jinja2-3.0.0a1-py3.8.egg/jinja2/sandbox.py", line 310, in is_safe_callable
    getattr(obj, "unsafe_callable", False) or getattr(obj, "alters_data", False)
jinja2.exceptions.UndefinedError: '_' is undefined

Expected behavior
Build succeeds.

Your project
N/A.

Screenshots
No.

Environment info

  • OS: Mac
  • Python version: 3.8.2
  • Sphinx version: 3.x
  • Sphinx extensions: N/A
  • Extra tools: No.

Metadata

Metadata

Assignees

No one assigned

    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