From 324e03e4a56f1d8ca56fc17e6c1d77377f20b99c Mon Sep 17 00:00:00 2001 From: Luna <145792949+Lunalicious@users.noreply.github.com> Date: Wed, 23 Apr 2025 08:55:29 +0000 Subject: [PATCH] pptx2md #69 As mentioned in Issue #69, here is my PR :) python-pptx will throw a ValueError, if the lazily loaded file extension of an image is not a supported type (e.g. MPO) - ref. parser.py:155 This ValueError does not get caught while processing the shapes which in turn will crash the program . The simple solution is to just add ValueError to the exception tuple where it gets called in the process_shapes function. The other place the function gets called already has a try-except block and simply ignores all exceptions --- pptx2md/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pptx2md/parser.py b/pptx2md/parser.py index edcc10a..44e7496 100644 --- a/pptx2md/parser.py +++ b/pptx2md/parser.py @@ -219,7 +219,7 @@ def process_shapes(config: ConversionConfig, current_shapes, slide_id: int) -> L pic = process_picture(config, shape, slide_id) if pic: results.append(pic) - except AttributeError as e: + except (AttributeError, ValueError) as e: logger.warning(f'Failed to process picture, skipped: {e}') elif shape.shape_type == MSO_SHAPE_TYPE.TABLE: table = process_table(config, shape, slide_id)