I need to launch playwright from Flask to perform some automation. It works fine when I run it using python app.py but when I try to deploy it using uwsgi and nginx, I get this error
with sync_playwright() as p:
File "venv/lib/python3.8/site-packages/playwright/sync_api/_context_manager.py", line 83, in __enter__
playwright = self._playwright
AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright'
I am following the tutorial from this digitalocean article. I have deployed other Flask apps using the same tutorial and it works fine without playwright.
I am using Python 3.8 and Flask==2.1.2, playwright==1.22.0 version.