From a9481a072939f3ea16c36e9a47e89de41fa557e9 Mon Sep 17 00:00:00 2001 From: Weijing Jay Lin Date: Thu, 13 Nov 2025 12:03:18 -0800 Subject: [PATCH] Improve error message for import exception group --- sphinx/ext/autosummary/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py index dedc203d919..e5adfa1621d 100644 --- a/sphinx/ext/autosummary/__init__.py +++ b/sphinx/ext/autosummary/__init__.py @@ -684,7 +684,7 @@ def import_by_name( exceptions: list[BaseException] = functools.reduce( operator.iadd, (e.exceptions for e in errors), [] ) - raise ImportExceptionGroup('no module named %s' % ' or '.join(tried), exceptions) + raise ImportExceptionGroup(f'could not import {" or ".join(tried)}', exceptions) def _import_by_name(name: str, grouped_exception: bool = True) -> tuple[Any, Any, str]: