-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·50 lines (43 loc) · 1.67 KB
/
main.py
File metadata and controls
executable file
·50 lines (43 loc) · 1.67 KB
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
#!/usr/bin/env python3
"""
Route Planner - Primary Entry Point
===================================
This is the main development and direct execution entry point.
Use this for:
- Development and testing
- Direct Python execution: python main.py
- IDE integration
For end-users, see the installation guide for easier methods.
"""
import sys
import subprocess
from pathlib import Path
def main():
"""Main entry point that delegates to the package entry point."""
# Try to import and run the package directly
try:
from route_planner.core import main as app_main
app_main()
except ImportError:
# Fallback: delegate to shell script for proper environment setup
project_root = Path(__file__).parent.absolute()
shell_script = project_root / ('run_route_planner.bat' if sys.platform == 'win32' else 'run_route_planner.sh')
if not shell_script.exists():
# Use ASCII-safe error message for Windows compatibility
error_msg = f"ERROR: {shell_script.name} not found"
print(error_msg)
sys.exit(1)
# Execute the shell script which handles environment activation
try:
# Pass any command line arguments to the shell script
result = subprocess.run([str(shell_script)] + sys.argv[1:],
cwd=str(project_root))
sys.exit(result.returncode)
except KeyboardInterrupt:
print("\nApplication interrupted by user")
sys.exit(0)
except Exception as e:
print(f"ERROR: Error running application: {e}")
sys.exit(1)
if __name__ == "__main__":
main()