Skip to content

Error in _overwrite_pygments_css: DirectoryHTMLBuilder' object has no attribute 'globalcontext' #1096

@choldgraf

Description

@choldgraf

In building the documentation with Sphinx 5.3, I am occasionally getting this error message:

Handler <function _overwrite_pygments_css at 0x7f971a03caf0> for event 'build-finished' threw an exception (exception: 'DirectoryHTMLBuilder' object has no attribute 'globalcontext')

I believe it's coming from this line:

theme_name = app.config.html_theme_options.get(
style_key, app.builder.globalcontext.get(f"theme_{style_key}")
)

It still seems to be in-use by Sphinx, so not really sure what's going on:

https://github.com/sphinx-doc/sphinx/blob/ff202240abebd12b1e12c9052e11f785c401e725/sphinx/builders/html/__init__.py#L569-L573

Maybe we need to add a similar conditional?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions