Darshan03 commited on
Commit
249d2a0
·
verified ·
1 Parent(s): b1cc62e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -7
app.py CHANGED
@@ -35,16 +35,24 @@ def install_playwright_dependencies():
35
 
36
  print("Installing Playwright dependencies...")
37
  if sys.platform.startswith("linux"):
38
- subprocess.run(["sudo", "apt-get", "update"], check=True)
39
- subprocess.run([
40
- "sudo", "apt-get", "install", "-y",
41
- "libnss3", "libnspr4", "libatk1.0-0", "libatk-bridge2.0-0",
42
- "libcups2", "libxcomposite1", "libxdamage1", "libatspi2.0-0"
43
- ], check=True)
 
 
 
 
44
  elif sys.platform.startswith("win"):
45
  print("Ensure Windows has necessary dependencies (WSL may be required).")
 
46
  elif sys.platform.startswith("darwin"):
47
- subprocess.run(["brew", "install", "playwright"], check=True)
 
 
 
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)