Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix: friendly error for missing optional dependencies

hugohe312b1cc16d6b8
diff --git a/skills/ppt-master/scripts/image_gen.py b/skills/ppt-master/scripts/image_gen.py
index b964b042..21f087d8 100644
--- a/skills/ppt-master/scripts/image_gen.py
+++ b/skills/ppt-master/scripts/image_gen.py
@@ -267,10 +267,26 @@ def _build_backend_aliases() -> dict[str, str]:
BACKEND_ALIASES = _build_backend_aliases()
+_BACKEND_PIP_HINTS = {
+ "gemini": "google-genai",
+ "openai": "openai",
+}
+
+
def _load_backend(canonical_name: str) -> tuple[object, str]:
"""Import and return the configured backend module."""
module_name = f"image_backends.{BACKEND_REGISTRY[canonical_name]['module']}"
- module = __import__(module_name, fromlist=["*"])
+ try:
+ module = __import__(module_name, fromlist=["*"])
+ except ImportError as exc:
+ pip_name = _BACKEND_PIP_HINTS.get(canonical_name, exc.name or "<dependency>")
+ print(
+ f"Error: backend '{canonical_name}' needs a package that is not installed.\n"
+ f"Missing: {exc.name}\n"
+ f"Run: pip install {pip_name}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
return module, canonical_name
diff --git a/skills/ppt-master/scripts/source_to_md/pdf_to_md.py b/skills/ppt-master/scripts/source_to_md/pdf_to_md.py
index b018670f..9d1854d3 100644
--- a/skills/ppt-master/scripts/source_to_md/pdf_to_md.py
+++ b/skills/ppt-master/scripts/source_to_md/pdf_to_md.py
@@ -5,14 +5,20 @@ Uses PyMuPDF to extract PDF text content and convert to Markdown format.
Supports heading levels, bold, italic, and list detection.
"""
-import fitz # PyMuPDF
import argparse
import hashlib
import os
import re
+import sys
from pathlib import Path
from collections import Counter
+try:
+ import fitz # PyMuPDF
+except ImportError:
+ print("[ERROR] PyMuPDF not installed. Run: pip install PyMuPDF", file=sys.stderr)
+ sys.exit(1)
+
FONT_BODY_SIZE = 12
FONT_H1_SIZE = 24
FONT_H2_SIZE = 18