File size: 1,844 Bytes
1f38061
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/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()