File size: 2,547 Bytes
7b84343 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #!/usr/bin/env python3
"""
LinkedIn Party Planner - Startup Script
"""
import sys
import os
def check_dependencies():
"""Check if required dependencies are installed"""
try:
import flask
import selenium
import webdriver_manager
print("β
All dependencies are installed")
return True
except ImportError as e:
print(f"β Missing dependency: {e}")
print("Please run: pip install -r requirements.txt")
return False
def check_chrome():
"""Check if Chrome browser is available"""
import subprocess
try:
# Try to find Chrome on different platforms
chrome_paths = [
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", # macOS
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", # Windows
"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", # Windows 32-bit
"/usr/bin/google-chrome", # Linux
"/usr/bin/chromium-browser" # Linux Chromium
]
for path in chrome_paths:
if os.path.exists(path):
print("β
Chrome browser found")
return True
# Try using 'which' command
result = subprocess.run(['which', 'google-chrome'], capture_output=True, text=True)
if result.returncode == 0:
print("β
Chrome browser found")
return True
print("β οΈ Chrome browser not found in common locations")
print("Please make sure Chrome is installed and accessible")
return False
except Exception as e:
print(f"β οΈ Could not verify Chrome installation: {e}")
return True # Assume it's available
def main():
"""Main startup function"""
print("π LinkedIn Party Planner")
print("=" * 40)
# Check dependencies
if not check_dependencies():
sys.exit(1)
# Check Chrome
check_chrome()
print("\nπ Starting the application...")
print("π The app will be available at: http://localhost:5000")
print("π For help, see README.md")
print("\n" + "=" * 40)
# Import and run the app
try:
from app import app
app.run(debug=True, host='0.0.0.0', port=5000)
except KeyboardInterrupt:
print("\nπ Application stopped by user")
except Exception as e:
print(f"\nβ Error starting application: {e}")
sys.exit(1)
if __name__ == "__main__":
main() |