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

Puzzling traceback when python -msphinx.ext.intersphinx is used with an invalid url #5320

Closed
anntzer opened this issue Aug 20, 2018 · 2 comments

Comments

@anntzer
Copy link
Contributor

anntzer commented Aug 20, 2018

Subject: Puzzling traceback when python -msphinx.ext.intersphinx is used with an invalid url

Problem

When running e.g. python -msphinx.ext.intersphinx https://www.sphinx-doc.org/, one gets a rather puzzling traceback:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/sphinx/ext/intersphinx.py", line 197, in fetch_inventory
    invdata = InventoryFile.load(f, uri, join)
  File "/usr/lib/python3.7/site-packages/sphinx/util/inventory.py", line 108, in load
    raise ValueError('invalid inventory header: %s' % line)
ValueError: invalid inventory header: 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.7/site-packages/sphinx/ext/intersphinx.py", line 420, in <module>
    inspect_main(argv=sys.argv[1:])  # type: ignore
  File "/usr/lib/python3.7/site-packages/sphinx/ext/intersphinx.py", line 407, in inspect_main
    invdata = fetch_inventory(MockApp(), '', filename)  # type: ignore
  File "/usr/lib/python3.7/site-packages/sphinx/ext/intersphinx.py", line 199, in fetch_inventory
    raise ValueError('unknown or unsupported inventory version: %r' % exc)
ValueError: ('intersphinx inventory %r not readable due to %s: %s', 'https://www.sphinx-doc.org', 'ValueError', ValueError(...))

Yes, I know that the correct invocation is python -msphinx.ext.intersphinx/objects.inv, but it looks like something went wrong in the formatting of the error reporting (one would expect an error message ending with something like "intersphinx inventory ... not readable due to ..." but not and error while formatting that message...).

Procedure to reproduce the problem

See above.

Error logs / results

See above.

Expected results

See above. Alternatively, it may be worth trying url/objects.inv whenever url fails to be loaded correctly as an intersphinx db (or at least whenever url doesn't end with objects.inv, as I think it is expected that it always has that name?), especially as this is consistent with how the url is specified in conf.py (without the trailing objects.inv).

Reproducible project / your project

N/A

Environment info

  • OS: Arch Linux
  • Python version: 3.7
  • Sphinx version: 1.7.7
@tk0miya tk0miya added this to the 1.7.8 milestone Aug 21, 2018
@tk0miya
Copy link
Member

tk0miya commented Aug 21, 2018

+1; the error is too ugly.

tk0miya added a commit to tk0miya/sphinx that referenced this issue Aug 22, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
tk0miya added a commit that referenced this issue Aug 22, 2018
Fix #5320: intersphinx: crashed if invalid url given
@tk0miya
Copy link
Member

tk0miya commented Aug 22, 2018

Fixed by #5320.
Thank you for reporting.

@tk0miya tk0miya closed this as completed Aug 22, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants