{"record":{"id":"883726b6d8df9586","repo":"PaddlePaddle/PaddleOCR","slug":"pptx-conversion-requires-python-pptx-pip-install","errorCode":null,"errorMessage":"PPTX conversion requires python-pptx: pip install paddleocr[doc2md]","messagePattern":"PPTX conversion requires python-pptx: pip install paddleocr\\[doc2md\\]","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"paddleocr/_doc2md/converters/pptx.py","lineNumber":166,"sourceCode":"    if url:\n        escaped_url = _escape_md_url(url)\n        t = f\"[{t}]({escaped_url})\"\n    return t\n\n\n@default_registry.register\nclass PptxConverter(BaseConverter):\n    supported_extensions = [\"pptx\"]\n    supported_mimetypes = [\n        \"application/vnd.openxmlformats-officedocument.presentationml.presentation\"\n    ]\n\n    def convert_file(self, file_path: Path, **kwargs) -> ConvertResult:\n        try:\n            from pptx import Presentation\n            from pptx.shapes.picture import Picture\n        except ImportError:\n            raise RuntimeError(\n                \"PPTX conversion requires python-pptx: pip install paddleocr[doc2md]\"\n            )\n        try:\n            from pptx.enum.shapes import MSO_SHAPE_TYPE\n        except ImportError:\n            MSO_SHAPE_TYPE = None  # type: ignore[assignment]\n\n        prs = Presentation(str(file_path))\n        slides_md = []\n        images: dict = {}\n        image_counter = [0]\n        slide_width = prs.slide_width\n        self._Picture = Picture\n        self._MSO_SHAPE_TYPE = MSO_SHAPE_TYPE\n\n        for slide in prs.slides:\n            slide_parts = []\n","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr/_doc2md/converters/pptx.py#L148-L184","documentation":"RuntimeError raised by PptxConverter.convert_file when importing python-pptx (Presentation, Picture) fails. PPTX-to-Markdown conversion is gated behind the optional doc2md extra, which bundles python-pptx.","triggerScenarios":"doc2md_convert('slides.pptx') without python-pptx installed; iterating a directory of mixed Office files where any .pptx triggers this converter.","commonSituations":"Document-ingestion services that accept arbitrary Office formats but were deployed without the doc2md extra.","solutions":["pip install 'paddleocr[doc2md]'","Or directly: pip install python-pptx","Add a startup dependency probe for all formats you intend to accept"],"exampleFix":"# before (shell)\npip install paddleocr\n# after\npip install 'paddleocr[doc2md]'","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif importlib.util.find_spec('pptx') is None:\n    raise RuntimeError('python-pptx missing: pip install paddleocr[doc2md]')","typeGuard":null,"tryCatchPattern":"try:\n    result = doc2md_convert(path)\nexcept RuntimeError as e:\n    if 'python-pptx' in str(e):\n        fail_with_install_hint(e)\n    raise","preventionTips":["Install the doc2md extra when accepting .pptx uploads","Gate file types on a probe of their converter deps"],"tags":["optional-dependency","doc2md","pptx","installation"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}