Update app.py
Browse files
app.py
CHANGED
|
@@ -35,16 +35,24 @@ def install_playwright_dependencies():
|
|
| 35 |
|
| 36 |
print("Installing Playwright dependencies...")
|
| 37 |
if sys.platform.startswith("linux"):
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
elif sys.platform.startswith("win"):
|
| 45 |
print("Ensure Windows has necessary dependencies (WSL may be required).")
|
|
|
|
| 46 |
elif sys.platform.startswith("darwin"):
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
print("Installing Playwright browsers...")
|
| 50 |
subprocess.run([sys.executable, "-m", "playwright", "install"], check=True)
|
|
|
|
| 35 |
|
| 36 |
print("Installing Playwright dependencies...")
|
| 37 |
if sys.platform.startswith("linux"):
|
| 38 |
+
try:
|
| 39 |
+
subprocess.run(["apt-get", "update"], check=True)
|
| 40 |
+
subprocess.run([
|
| 41 |
+
"apt-get", "install", "-y",
|
| 42 |
+
"libnss3", "libnspr4", "libatk1.0-0", "libatk-bridge2.0-0",
|
| 43 |
+
"libcups2", "libxcomposite1", "libxdamage1", "libatspi2.0-0"
|
| 44 |
+
], check=True)
|
| 45 |
+
except Exception as e:
|
| 46 |
+
print(f"Warning: Failed to install dependencies. Try manually: {e}")
|
| 47 |
+
|
| 48 |
elif sys.platform.startswith("win"):
|
| 49 |
print("Ensure Windows has necessary dependencies (WSL may be required).")
|
| 50 |
+
|
| 51 |
elif sys.platform.startswith("darwin"):
|
| 52 |
+
try:
|
| 53 |
+
subprocess.run(["brew", "install", "playwright"], check=True)
|
| 54 |
+
except Exception as e:
|
| 55 |
+
print(f"Warning: Failed to install Playwright on macOS. {e}")
|
| 56 |
|
| 57 |
print("Installing Playwright browsers...")
|
| 58 |
subprocess.run([sys.executable, "-m", "playwright", "install"], check=True)
|