diff --git a/packages/markitdown/src/markitdown/converters/_pptx_converter.py b/packages/markitdown/src/markitdown/converters/_pptx_converter.py index 087da32..a518a45 100644 --- a/packages/markitdown/src/markitdown/converters/_pptx_converter.py +++ b/packages/markitdown/src/markitdown/converters/_pptx_converter.py @@ -168,11 +168,13 @@ class PptxConverter(DocumentConverter): # Group Shapes if shape.shape_type == pptx.enum.shapes.MSO_SHAPE_TYPE.GROUP: - sorted_shapes = sorted(shape.shapes, key=attrgetter("top", "left")) + not_none_shapes = [shape for shape in slide.shapes if shape.top is not None and shape.left is not None] + sorted_shapes = sorted(not_none_shapes, key=attrgetter("top", "left")) for subshape in sorted_shapes: get_shape_content(subshape, **kwargs) - sorted_shapes = sorted(slide.shapes, key=attrgetter("top", "left")) + not_none_shapes = [shape for shape in slide.shapes if shape.top is not None and shape.left is not None] + sorted_shapes = sorted(not_none_shapes, key=attrgetter("top", "left")) for shape in sorted_shapes: get_shape_content(shape, **kwargs)