Zhixu Liu <zhixu.liu@xxxxxxxxx> writes: > docutils.utils.error_reporting was removed in docutils v0.22, causing sphinx > extensions (e.g. kernel_include) to fail with: > >> File "/usr/lib/python3.12/site-packages/sphinx/registry.py", line 544, in load_extension >> raise ExtensionError( >> sphinx.errors.ExtensionError: Could not import extension kernel_include (exception: No module named 'docutils.utils.error_reporting') > > Add compatibility handling with try/except (more robust than checking > version numbers): > - SafeString -> str > - ErrorString -> docutils.io.error_string() > > Signed-off-by: Z. Liu <zhixu.liu@xxxxxxxxx> > --- > Documentation/sphinx/kernel_feat.py | 6 +++++- > Documentation/sphinx/kernel_include.py | 7 ++++++- > Documentation/sphinx/maintainers_include.py | 6 +++++- > 3 files changed, 16 insertions(+), 3 deletions(-) > > diff --git a/Documentation/sphinx/kernel_feat.py > b/Documentation/sphinx/kernel_feat.py > index e3a51867f27bd..d077645254cd4 100644 > --- a/Documentation/sphinx/kernel_feat.py > +++ b/Documentation/sphinx/kernel_feat.py > @@ -40,7 +40,11 @@ import sys > from docutils import nodes, statemachine > from docutils.statemachine import ViewList > from docutils.parsers.rst import directives, Directive > -from docutils.utils.error_reporting import ErrorString > +try: > + from docutils.utils.error_reporting import ErrorString > +except ImportError: > + # docutils >= 0.22 > + from docutils.io import error_string as ErrorString > from sphinx.util.docutils import switch_source_input This is a step in the right direction ... but the exception you report in the changelog is sphinx.errors.ExtensionError; why a different exception here? I would still rather just look at the docutils version in any case, rather than trying to interpret exceptions. Thanks, jon