Skip to content

Commit 1b93988

Browse files
authored
Fix Python 3.12 import AttributeError (#7482)
Fixes #7458 ### Description https://github.com/python/cpython/blob/a21c0c7def9a8495f1166d9b434dfc301cb92bff/Lib/importlib/abc.py#L68 ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: YunLiu <[email protected]>
1 parent df37a22 commit 1b93988

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

monai/utils/module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def load_submodules(
209209
if (is_pkg or load_all) and name not in sys.modules and match(exclude_pattern, name) is None:
210210
try:
211211
mod = import_module(name)
212-
importer.find_module(name).load_module(name) # type: ignore
212+
importer.find_spec(name).loader.load_module(name) # type: ignore
213213
submodules.append(mod)
214214
except OptionalImportError:
215215
pass # could not import the optional deps., they are ignored

0 commit comments

Comments
 (0)