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

WARNING: Color theme None not found by pygments, falling back to XXX #1263

Closed
HealthyPear opened this issue Mar 23, 2023 · 2 comments · Fixed by #1264
Closed

WARNING: Color theme None not found by pygments, falling back to XXX #1263

HealthyPear opened this issue Mar 23, 2023 · 2 comments · Fixed by #1264
Labels
kind: bug Something isn't working

Comments

@HealthyPear
Copy link
Contributor

HealthyPear commented Mar 23, 2023

I have Sphinx v6.1.3 and pydata-sphinx-theme v0.13.1 and get these warning messages,

WARNING: Color theme None not found by pygments, falling back to tango.
WARNING: Color theme None not found by pygments, falling back to monokai.

After a make clean it works again, but it re-appears on re-builds.

On top of that, it seems to be erratic, I cannot reproduce this deterministically.

I found the same issue reported in executablebooks/sphinx-book-theme#690 and as far as I understand for them it's an upstream issue, so here I am!

Any takers?

@drammock
Copy link
Collaborator

I think I see how this is happening. Here:

# globalcontext sometimes doesn't exist so this ensures we do not error
theme_name = _get_theme_options(app).get(style_key, None)
if theme_name is None and hasattr(app.builder, "globalcontext"):
theme_name = app.builder.globalcontext.get(f"theme_{style_key}")

we added the hasattr condition to prevent errors, but this allows theme_name to continue being None sometimes, which then triggers the warning on the subsequent lines.

I think the right fix here is to just not warn if theme_name is None... we really only need to warn if the user specifically asked for a highlighting theme that we can't actually deliver. I'll open a PR.

@12rambau
Copy link
Collaborator

I get this one sometimes for no reason and then it behaves normally again. Kudos if you find the root of the problem

@trallard trallard added the kind: bug Something isn't working label Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants