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

rediraffecheckdiff fails when using a redirect dict #58

Open
doismellburning opened this issue Feb 12, 2024 · 0 comments
Open

rediraffecheckdiff fails when using a redirect dict #58

doismellburning opened this issue Feb 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@doismellburning
Copy link

doismellburning commented Feb 12, 2024

Running rediraffecheckdiff on a Sphinx setup where rediraffe_redirects is set to an empty dict in conf.py results in an AttributeError: 'NoneType' object has no attribute 'open' that looks to come from rediraffe assuming rediraffe_redirects is a file (despite documentation and source indicating that both files and dicts should be supported)

Specifically:

$ grep --after-context=1 ^rediraffe source/conf.py 
rediraffe_branch = "main"
rediraffe_redirects = {
}

$ pipenv run sphinx-build -b=rediraffecheckdiff source build -W --keep-going -E -v
Running Sphinx v7.2.6
Initializing Spelling Checker 8.0.0
locale_dir /Users/doismellburning/git/tech-docs/source/locales/en/LC_MESSAGES does not exist

Traceback (most recent call last):
  File "/Users/doismellburning/.local/share/virtualenvs/tech-docs-26HPyE37/lib/python3.9/site-packages/sphinx/cmd/build.py", line 293, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/Users/doismellburning/.local/share/virtualenvs/tech-docs-26HPyE37/lib/python3.9/site-packages/sphinx/application.py", line 272, in __init__
    self._init_builder()
  File "/Users/doismellburning/.local/share/virtualenvs/tech-docs-26HPyE37/lib/python3.9/site-packages/sphinx/application.py", line 342, in _init_builder
    self.builder.init()
  File "/Users/doismellburning/.local/share/virtualenvs/tech-docs-26HPyE37/lib/python3.9/site-packages/sphinxext/rediraffe.py", line 386, in init
    with redirects_path.open("a") as redirects_file:
AttributeError: 'NoneType' object has no attribute 'open'
[snip]

It looks like there's logic at https://github.com/wpilibsuite/sphinxext-rediraffe/blob/v0.2.7/sphinxext/rediraffe.py#L301-L302 to check for if the config is a dict, but then later https://github.com/wpilibsuite/sphinxext-rediraffe/blob/v0.2.7/sphinxext/rediraffe.py#L386 just assumes there's a file to be opened

doismellburning added a commit to doismellburning/sphinxext-rediraffe that referenced this issue Feb 12, 2024
@TheTripleV TheTripleV added the bug Something isn't working label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants