-
-
Notifications
You must be signed in to change notification settings - Fork 122
Closed
Labels
unconfirmedThis bug was not reproduced yetThis bug was not reproduced yet
Description
When using the python handler and importing cross references using the import config option:
plugins:
- search
- autorefs
- mkdocstrings:
default_handler: python
# generate objects.inv sphinx inventory file in site/ dir to support external cross references
enable_inventory: true
handlers:
python:
import:
- https://docs.python.org/3/objects.inv
- https://pint.readthedocs.io/en/stable/objects.inv
- http://numpy.org/devdocs/objects.invIf one of the referenced HTTP addresses is not reachable for some reason, mkdocs just dumps out a stack dump with an HTTP error without including the offending URL, e.g.:
Traceback (most recent call last):
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/bin/mkdocs", line 10, in <module>
sys.exit(cli())
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/site-packages/mkdocs/__main__.py", line 250, in build_command
build.build(cfg, dirty=not clean)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/site-packages/mkdocs/commands/build.py", line 311, in build
env = config.plugins.run_event('env', env, config=config, files=files)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/site-packages/mkdocs/plugins.py", line 520, in run_event
result = method(item, **kwargs)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/site-packages/mkdocstrings/plugin.py", line 243, in on_env
for page, identifier in collections.ChainMap(*(fut.result() for fut in self._inv_futures)).items():
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/site-packages/mkdocstrings/plugin.py", line 243, in <genexpr>
for page, identifier in collections.ChainMap(*(fut.result() for fut in self._inv_futures)).items():
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/site-packages/mkdocstrings/plugin.py", line 296, in _load_inventory
with request.urlopen(req) as resp: # noqa: S310 (URL audit OK: comes from a checked-in config)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/urllib/request.py", line 216, in urlopen
return opener.open(url, data, timeout)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/urllib/request.py", line 525, in open
response = meth(req, response)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/urllib/request.py", line 634, in http_response
response = self.parent.error(
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/urllib/request.py", line 557, in error
result = self._call_chain(*args)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/urllib/request.py", line 496, in _call_chain
result = func(*args)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/urllib/request.py", line 749, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/urllib/request.py", line 525, in open
response = meth(req, response)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/urllib/request.py", line 634, in http_response
response = self.parent.error(
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/urllib/request.py", line 563, in error
return self._call_chain(*args)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/urllib/request.py", line 496, in _call_chain
result = func(*args)
File "/Users/Christopher.Barber/miniconda3/envs/eispydata/lib/python3.10/urllib/request.py", line 643, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
make: *** [doc] Error 1
When this happens you end up having to comment out the imports one by one to figure out what the broken URL is.
Instead such errors should also print out the URL.
Although this is triggered by use of the mkdocstrings-python handler, I assume this is an issue with mkdocstrings itself
because I don't see handler specific functions in the stack.
- OS : mac os 12.6
- mkdocstrings 0.19.1
- mkdocstrings-python: 0.8.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
unconfirmedThis bug was not reproduced yetThis bug was not reproduced yet