From 4b6d6560f208c18780d578d4820e43e962c30992 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 9 Feb 2025 10:04:49 +0530 Subject: [PATCH] Fix DeprecationWarning --- src/calibre/ebooks/docx/cleanup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/docx/cleanup.py b/src/calibre/ebooks/docx/cleanup.py index 26addea801..5fed992ad1 100644 --- a/src/calibre/ebooks/docx/cleanup.py +++ b/src/calibre/ebooks/docx/cleanup.py @@ -122,7 +122,7 @@ def cleanup_markup(log, root, styles, dest_dir, detect_cover, XPath, uuid): span.attrib.pop('data-noteref-container') parent = span.getparent() idx = parent.index(span) - if idx + 1 < len(parent) and (ns := parent[idx+1]) and hasattr(ns, 'get') and ns.get('data-noteref-container'): + if idx + 1 < len(parent) and len(ns := parent[idx+1]) and hasattr(ns, 'get') and ns.get('data-noteref-container'): if len(span) and not span[-1].tail: span[-1].tail = '\xa0'