From d1687571bf55948a2c9883cf3534dc5d6a4fe191 Mon Sep 17 00:00:00 2001 From: Dimitris Rongotis Date: Thu, 15 Feb 2024 15:55:19 +0200 Subject: [PATCH] Skip element when MissingParent exception raised While compiling a pptx file with a page element (<#>), skip this element --- openformats/formats/office_open_xml/parser.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openformats/formats/office_open_xml/parser.py b/openformats/formats/office_open_xml/parser.py index 7305bc19..78f1b1b7 100644 --- a/openformats/formats/office_open_xml/parser.py +++ b/openformats/formats/office_open_xml/parser.py @@ -206,8 +206,10 @@ def compile_paragraph(cls, paragraph, rels_soup, stringset, is_rtl=False): continue last_element = text_element - - hyperlink_url = cls.get_hyperlink_url(text_element, rels_soup) + try: + hyperlink_url = cls.get_hyperlink_url(text_element, rels_soup) + except MissingParentError: + continue # the text parts of the translation are less that the # text parts of the document, so we will just remove