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

Error when building docs: 'dict object' has no attribute 'image_relative' #1392

Open
Seniatical opened this issue Jul 24, 2023 · 7 comments
Open

Comments

@Seniatical
Copy link

After updating to the latest version, i've been getting a new error which I cannot seem to resolve.

Traceback

Traceback (most recent call last):
  File "c:\users\isa\appdata\local\programs\python\python39\lib\site-packages\sphinx\events.py", line 96, in emit
    results.append(listener.handler(self.app, *args))
  File "c:\users\isa\appdata\local\programs\python\python39\lib\site-packages\pydata_sphinx_theme\__init__.py", line 223, in update_and_remove_templates
    context[section] = list(filter(_remove_empty_templates, context[section]))
  File "c:\users\isa\appdata\local\programs\python\python39\lib\site-packages\pydata_sphinx_theme\__init__.py", line 218, in _remove_empty_templates
    rendered = app.builder.templates.render(tname, context)
  File "c:\users\isa\appdata\local\programs\python\python39\lib\site-packages\sphinx\jinja2glue.py", line 196, in render
    return self.environment.get_template(template).render(context)
  File "c:\users\isa\appdata\local\programs\python\python39\lib\site-packages\jinja2\environment.py", line 1304, in render
    self.environment.handle_exception()
  File "c:\users\isa\appdata\local\programs\python\python39\lib\site-packages\jinja2\environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "C:\Users\Isa\AppData\Local\Programs\Python\Python39\Lib\site-packages\pydata_sphinx_theme\theme\pydata_sphinx_theme\components\navbar-logo.html", line 13, in top-level template code
    {% set is_logo = "light" in theme_logo["image_relative"] %}
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'image_relative'

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

Extension error (pydata_sphinx_theme):
Handler <function update_and_remove_templates at 0x000001CA9046AEE0> for event 'html-page-context' threw an exception (exception: 'dict object' has no attribute 'image_relative')

Pydata Sphinx Theme Version

  • 0.13.4.dev0

Sphinx Version

  • 7.0.1

Python Version

  • 3.9.5
@mlange-42
Copy link

Getting the same error, using Pydata Sphinx Theme v0.13.0 and Sphinx v6.1.3

@12rambau
Copy link
Collaborator

@Seniatical , For the first issue I think the problem is coming from the Version 7 of Sphinx. this has been solved since then in main but I would suggest to pin version of Sphinx for the time being.

@mlange-42, Could you update your version to the latest one (0.13.4) I remember working on this issue some time ago, it should be available now.

@mlange-42
Copy link

v0.13.4 is not available via pip, and the repo also has no such tag. Installing from the main branch of the repo does not solve the issue.

@12rambau
Copy link
Collaborator

my bad it's 0.13.3 but if you still face it with main it's an issue.

Would you mind sharing your conf.py ?

@12rambau
Copy link
Collaborator

I've just release v0.14.0 you can give it a try but I guess it won't change anything from your side as you already checked with main.
Would you minde sharing your conf.py so I see what parameter you use ? or even better the repository you are working with so I can make a fork for testing purposes.

@adam-grant-hendry
Copy link

I have this error with pydata_sphinx_theme==0.14.1, but I am unsure if this is due to sphinx-multiversion or pydata_sphinx_theme. Link to the full error, including system info and MRE here.

@12rambau
Copy link
Collaborator

@adam-grant-hendry your error seems to be related to sphinx-multiversion only. you should try to run the call that is raising the rror to get a more meaningful traceback.

This issue is only focusing on the management of the image_relative that seems broken for some of our users.

@12rambau 12rambau changed the title Error when building docs Error when building docs: 'dict object' has no attribute 'image_relative' Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants