From 5a0a391beb89a13ea4f303e39c10753f0c7f9bcb Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 27 Jun 2024 23:39:41 -0400 Subject: [PATCH] Fix crash when running with optimization In that case, `__doc__` is None. --- nbconvert/exporters/templateexporter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nbconvert/exporters/templateexporter.py b/nbconvert/exporters/templateexporter.py index c09e6583b..16fbf0a17 100644 --- a/nbconvert/exporters/templateexporter.py +++ b/nbconvert/exporters/templateexporter.py @@ -151,7 +151,11 @@ class TemplateExporter(Exporter): """ # finish the docstring - __doc__ = __doc__.format(filters="- " + "\n - ".join(sorted(default_filters.keys()))) + __doc__ = ( + __doc__.format(filters="- " + "\n - ".join(sorted(default_filters.keys()))) + if __doc__ + else None + ) _template_cached = None