fix(pptx): handle picture shapes with external image references #2914
+5
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When processing PowerPoint files containing picture shapes that reference external images (rather than embedded images), the python-pptx library raises a ValueError("no embedded image") when accessing the
imageproperty.Previously, this caused the entire document conversion to fail because:
The
hasattr(shape, "image")check at line 690 would trigger the property getter, which raises ValueError (hasattr only catches AttributeError, not ValueError)The exception handler in
_handle_pictures()only caught UnidentifiedImageError and OSError, not ValueErrorThis fix:
_handle_pictures()so that picture shapes with external references are gracefully skipped with a warning instead of crashing the pipeline