Skip to content

fix(browser): degrade gracefully when Playwright is unavailable#483

Open
kvandre12-commits wants to merge 1 commit into
mpfaffenberger:mainfrom
kvandre12-commits:android-graceful-deps
Open

fix(browser): degrade gracefully when Playwright is unavailable#483
kvandre12-commits wants to merge 1 commit into
mpfaffenberger:mainfrom
kvandre12-commits:android-graceful-deps

Conversation

@kvandre12-commits

Copy link
Copy Markdown

Importing the browser stack hard-failed with ModuleNotFoundError: No module named 'playwright' on any environment without a Playwright wheel (e.g. Termux/Android, or a minimal install), which took down the whole app at import time.

Wrap the playwright.async_api import in try/except: when present it's an unchanged no-op (real types bind); when absent, bind the type names to Any and install a tiny runtime stub module so the other browser tool modules stay importable. Browser tools raise a clear, friendly error only if actually invoked without Playwright.

Tested on Android/Termux (no Playwright): 'import code_puppy.tools' now succeeds where it previously crashed; no change when Playwright is installed.

Importing the browser stack hard-failed with ModuleNotFoundError: No module
named 'playwright' on any environment without a Playwright wheel (e.g.
Termux/Android, or a minimal install), which took down the whole app at import
time.

Wrap the playwright.async_api import in try/except: when present it's an
unchanged no-op (real types bind); when absent, bind the type names to Any and
install a tiny runtime stub module so the other browser tool modules stay
importable. Browser tools raise a clear, friendly error only if actually
invoked without Playwright.

Tested on Android/Termux (no Playwright): 'import code_puppy.tools' now
succeeds where it previously crashed; no change when Playwright is installed.
@kvandre12-commits

Copy link
Copy Markdown
Author

fix(browser): degrade gracefully when Playwright is unavailable
#483

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant