Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Add submodules to sys.path to fix autodoc's "No module named 'health_azure'" #702

Conversation

JacopoTeneggi
Copy link
Contributor

Hi @fepegar ! I ran make html from your new branch and noticed I was still getting the following warning:

WARNING: autodoc: failed to import class 'config.SegmentationModelBase' from module '[InnerEye.ML](https://innereye.ml/)'; the following exception was raised:
Traceback (most recent call last):
  File "/cis/home/jteneggi/anaconda3/envs/InnerEye/lib/python3.7/site-packages/sphinx/util/inspect.py", line 324, in safe_getattr
    return getattr(obj, name, *defargs)
AttributeError: module '[InnerEye.ML](https://innereye.ml/)' has no attribute 'config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/cis/home/jteneggi/anaconda3/envs/InnerEye/lib/python3.7/site-packages/sphinx/ext/autodoc/importer.py", line 71, in import_object
    obj = attrgetter(obj, attrname)
  File "/cis/home/jteneggi/anaconda3/envs/InnerEye/lib/python3.7/site-packages/sphinx/ext/autodoc/__init__.py", line 246, in get_attr
    return autodoc_attrgetter(self.env.app, obj, name, *defargs)
  File "/cis/home/jteneggi/anaconda3/envs/InnerEye/lib/python3.7/site-packages/sphinx/ext/autodoc/__init__.py", line 2078, in autodoc_attrgetter
    return safe_getattr(obj, name, *defargs)
  File "/cis/home/jteneggi/anaconda3/envs/InnerEye/lib/python3.7/site-packages/sphinx/util/inspect.py", line 340, in safe_getattr
    raise AttributeError(name)
AttributeError: config
WARNING: autodoc: failed to import module 'config' from module '[InnerEye.ML](https://innereye.ml/)'; the following exception was raised:
No module named 'health_azure'

I propose to call fixed_paths.add_submodules_to_path() in conf.py as in ML/runner.py to make sure all submodules are imported correctly.

@fepegar fepegar deleted the branch microsoft:661-fix-sphinx-warnings March 22, 2022 09:46
@fepegar fepegar closed this Mar 22, 2022
@fepegar
Copy link
Contributor

fepegar commented Mar 22, 2022

Oops I didn't realise merging #699 would close this PR. I'm really sorry about that! Would it be easy to re-create this branch from main and submit again?

@JacopoTeneggi
Copy link
Contributor Author

Done! It is here #704

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants