{"record":{"id":"8866f0b15efbc49c","repo":"nexu-io/open-design","slug":"missing-playwright-run-python3-m-pip-install-pl","errorCode":null,"errorMessage":"Missing playwright. Run: python3 -m pip install playwright && python3 -m playwright install chromium","messagePattern":"Missing playwright\\. Run: python3 -m pip install playwright && python3 -m playwright install chromium","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"plugins/community/humanize-ppt/scripts/humanize_ppt_v2.py","lineNumber":1313,"sourceCode":"\ndef export_script_text():\n    return \"\"\"#!/usr/bin/env bash\nset -euo pipefail\nHERE=\"$(cd \"$(dirname \"$0\")\" && pwd)\"\nHTML=\"${1:-$HERE/package/index.html}\"\nOUT=\"${2:-$HERE/deck.pdf}\"\npython3 - \"$HTML\" \"$OUT\" <<'PY'\nimport asyncio, sys\nfrom pathlib import Path\n\nhtml_path = Path(sys.argv[1]).resolve()\nout_path = Path(sys.argv[2]).resolve()\n\nasync def main():\n    try:\n        from playwright.async_api import async_playwright\n    except Exception:\n        raise SystemExit(\"Missing playwright. Run: python3 -m pip install playwright && python3 -m playwright install chromium\")\n    async with async_playwright() as p:\n        browser = await p.chromium.launch()\n        page = await browser.new_page(viewport={\"width\": 1920, \"height\": 1080})\n        await page.goto(html_path.as_uri(), wait_until=\"networkidle\")\n        await page.pdf(path=str(out_path), width=\"1920px\", height=\"1080px\", print_background=True)\n        await browser.close()\n\nasyncio.run(main())\nprint(out_path)\nPY\n\"\"\"\n\n\ndef write_export_adapter(out, title, deck_path, slide_count):\n    deck = Path(deck_path).expanduser() if deck_path else None\n    if not deck or not deck.exists():\n        return {\"status\": \"missing-deck\", \"message\": f\"deck not found: {deck_path}\"}\n","sourceCodeStart":1295,"sourceCodeEnd":1331,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/plugins/community/humanize-ppt/scripts/humanize_ppt_v2.py#L1295-L1331","documentation":"Raised inside an inline Python heredoc embedded in a shell snippet (humanize_ppt_v2.py:1313) as `raise SystemExit(...)`. The heredoc launches Playwright to render an HTML deck to PDF; if `from playwright.async_api import async_playwright` raises any Exception, the script aborts with a SystemExit and prints the install instructions. The check is a broad `except Exception`, so any import-time failure (missing package, broken install, ABI mismatch) triggers it.","triggerScenarios":"The PDF export step runs (shell function invoked with an HTML path and output PDF path) on a machine where Playwright is not installed, only partially installed (package present but browsers missing), or where the async_api module cannot be imported due to a corrupted environment.","commonSituations":"Fresh machine that has the humanize-ppt scripts but never ran Playwright setup; user installed `playwright` via pip but forgot `python3 -m playwright install chromium`; CI image caching python packages but not the browser binaries; conflicting Playwright versions across venvs.","solutions":["Run the exact commands in the message in the same interpreter: `python3 -m pip install playwright && python3 -m playwright install chromium`.","Confirm the import works before re-running: `python3 -c \"from playwright.async_api import async_playwright; print('ok')\"`.","If pip reports playwright already installed but import fails, reinstall cleanly: `python3 -m pip install --force-reinstall playwright` then re-run the browser install.","In CI/containers, cache `~/.cache/ms-playwright` (the browser binaries) between runs so `playwright install chromium` is idempotent and fast."],"exampleFix":"// before (PDF export step fails)\n# SystemExit: Missing playwright. Run: python3 -m pip install playwright && ...\n\n// after\npython3 -m pip install playwright\npython3 -m playwright install chromium\npython3 -c \"from playwright.async_api import async_playwright\"  # verify\n# re-run the humanize-ppt step that triggered PDF export","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif importlib.util.find_spec('playwright') is None:\n    raise SystemExit(\n        \"Playwright is required for PDF export. \"\n        \"Run: python3 -m pip install playwright && \"\n        \"python3 -m playwright install chromium\"\n    )\n# also verify chromium is installed:\n# python3 -m playwright install chromium  (idempotent)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat Playwright as a hard prerequisite: document the two-step install (pip + browser download).","In CI, cache ~/.cache/ms-playwright to avoid re-downloading browsers each run.","Add a preflight `python3 -c \"from playwright.async_api import async_playwright\"` before the PDF stage.","Pin playwright versions to avoid surprise ABI breakages."],"tags":["dependency-missing","playwright","pdf","rendering","humanize-ppt"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}