From 341f41b61d3a4a810fa63824766b89cfb18e6467 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 16 Jun 2023 09:07:37 +0530 Subject: [PATCH] Fix #2024121 [[bug][convert] convert mobi to epub raise keyerror](https://bugs.launchpad.net/calibre/+bug/2024121) --- src/calibre/ebooks/oeb/polish/upgrade.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/polish/upgrade.py b/src/calibre/ebooks/oeb/polish/upgrade.py index ecd85ee2fd..d520066551 100644 --- a/src/calibre/ebooks/oeb/polish/upgrade.py +++ b/src/calibre/ebooks/oeb/polish/upgrade.py @@ -74,7 +74,10 @@ def collect_properties(container): if mt.lower() not in OEB_DOCS: continue name = container.href_to_name(item.get('href'), container.opf_name) - root = container.parsed(name) + try: + root = container.parsed(name) + except KeyError: + continue root = ensure_namespace_prefixes(root, {'epub': EPUB_NS}) properties = set() container.replace(name, root) # Ensure entities are converted