#!/usr/bin/env python3 """ Hackathon Team Organizer - Main Entry Point This script launches the Hackathon Team Organizer application. It ensures the working directory is set correctly before running the app. """ import os import sys import subprocess def main(): # Get the directory where this script is located script_dir = os.path.dirname(os.path.abspath(__file__)) # Change to the script directory to ensure relative paths work os.chdir(script_dir) # Add the current directory to the Python path sys.path.insert(0, script_dir) print("Starting Hackathon Team Organizer...") print(f"Working directory: {os.getcwd()}") # Check for OpenAI API key if not os.environ.get("OPENAI_API_KEY"): print("\n⚠️ WARNING: OPENAI_API_KEY environment variable is not set!") print("The application requires an OpenAI API key to function properly.") print("Please set it using:") print(" export OPENAI_API_KEY='your-api-key' (macOS/Linux)") print(" set OPENAI_API_KEY='your-api-key' (Windows)\n") print("Running simplified version without AI matching...") app_script = "hackathon_organizer/app_simple.py" else: print("OpenAI API key found. Running full version with AI matching...") app_script = "hackathon_organizer/app.py" # Run the application try: print(f"Launching application: {app_script}") subprocess.run([sys.executable, app_script], check=True) except KeyboardInterrupt: print("\nApplication stopped by user.") except subprocess.CalledProcessError as e: print(f"\nError running the application: {e}") sys.exit(1) except Exception as e: print(f"\nUnexpected error: {e}") sys.exit(1) if __name__ == "__main__": main()