Fix bundled app failing to find Chromium browser

Set PLAYWRIGHT_BROWSERS_PATH to ~/Library/Caches/ms-playwright/ so the
PyInstaller .app uses the system-wide browser cache instead of looking
inside its own bundle.
This commit is contained in:
Adam Moussa 2026-04-22 15:10:07 -04:00
parent 53aa0b7525
commit 1789eae0b5

View file

@ -1,9 +1,17 @@
"""Shared logic for Stampli bulk editor — used by both CLI scripts and the GUI.""" """Shared logic for Stampli bulk editor — used by both CLI scripts and the GUI."""
import json import json
import os
import time import time
from datetime import datetime, timedelta from datetime import datetime, timedelta
from pathlib import Path from pathlib import Path
# Use system-wide Playwright browser cache so the bundled app doesn't
# look for browsers inside its own .app bundle.
_pw_cache = Path.home() / "Library" / "Caches" / "ms-playwright"
if _pw_cache.is_dir():
os.environ.setdefault("PLAYWRIGHT_BROWSERS_PATH", str(_pw_cache))
from playwright.sync_api import sync_playwright from playwright.sync_api import sync_playwright
PROJECT_DIR = Path(__file__).parent PROJECT_DIR = Path(__file__).parent