Skip to content

Unhelpful error message when theme.conf is missing #11668

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

Closed
vsajip opened this issue Sep 1, 2023 · 1 comment · Fixed by #11671
Closed

Unhelpful error message when theme.conf is missing #11668

vsajip opened this issue Sep 1, 2023 · 1 comment · Fixed by #11671
Labels
type:enhancement enhance or introduce a new feature

Comments

@vsajip
Copy link
Contributor

vsajip commented Sep 1, 2023

Describe the bug

If the theme.conf file is missing, the code here:

self.config.read(path.join(self.themedir, THEMECONF), encoding='utf-8')

creates an empty configuration and fails a few lines later at
raise ThemeError(__('theme %r doesn\'t have "theme" setting') % name) from exc

because of course there's no [theme] section, as the file doesn't exist!

It would be more helpful to raise an error saying that the theme.conf file is missing.

How to Reproduce

Just remove theme.conf from a theme and try to build some documentation with that theme.

Environment Information

Platform:              linux; (Linux-4.15.0-213-generic-x86_64-with-glibc2.27)
Python version:        3.10.8 (main, Nov 24 2022, 07:33:30) [GCC 7.5.0])
Python implementation: CPython
Sphinx version:        7.2.5
Docutils version:      0.20.1
Jinja2 version:        3.1.2
Pygments version:      2.16.1

Sphinx extensions

None

Additional context

No response

@picnixz
Copy link
Member

picnixz commented Sep 2, 2023

PR is welcomed.

You can first check the existence of the file and raise a warning accordingly. (The current check on the 'theme' setting should still be done)

If no one submits a PR, I'll have a look at it upon my return (late September).

@picnixz picnixz added the type:enhancement enhance or introduce a new feature label Sep 2, 2023
vsajip added a commit to vsajip/sphinx that referenced this issue Sep 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:enhancement enhance or introduce a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants