Spaces:
Running
Running
Create download_browsers.py
Browse files- download_browsers.py +17 -0
download_browsers.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import subprocess
|
2 |
+
import sys
|
3 |
+
|
4 |
+
def download_playwright_browsers():
|
5 |
+
try:
|
6 |
+
print("Installing Playwright browsers...")
|
7 |
+
result = subprocess.run([sys.executable, "-m", "playwright", "install", "chromium"],
|
8 |
+
capture_output=True,
|
9 |
+
text=True)
|
10 |
+
print("Installation output:", result.stdout)
|
11 |
+
if result.stderr:
|
12 |
+
print("Installation errors:", result.stderr)
|
13 |
+
except Exception as e:
|
14 |
+
print(f"Error installing browsers: {e}")
|
15 |
+
|
16 |
+
if __name__ == "__main__":
|
17 |
+
download_playwright_browsers()
|