mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-08-06 19:28:06 +00:00
clear_cache.py and download_nba_logos.py pointed sys.path at a 'src' directory relative to the script's own folder (scripts/utils/src and scripts/src — neither exists), so both crashed on import; they now insert the project root and import via the src package like the other scripts. debug_web_manual.py resolved 'project root' to scripts/debug/ instead of two levels up. fix_nhl_cache.sh is removed: it used Python docstring syntax in a bash script and invoked clear_nhl_cache.py, which does not exist anywhere in the repo — it cannot ever have worked in its current location. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SXb4mKcAkVaxkeTb3YnAdr
92 lines
2.7 KiB
Python
92 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Web Interface Manual Debug Script
|
|
Run this to diagnose why web_interface/start.py isn't working
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
import traceback
|
|
from pathlib import Path
|
|
|
|
def main():
|
|
print("🔍 LED Matrix Web Interface Debug Tool")
|
|
print("=" * 50)
|
|
|
|
# Change to project root (two levels up from scripts/debug/)
|
|
project_root = Path(__file__).parent.parent.parent.resolve()
|
|
os.chdir(project_root)
|
|
print(f"📁 Working directory: {os.getcwd()}")
|
|
|
|
# Add to Python path
|
|
sys.path.insert(0, str(project_root))
|
|
print(f"🔗 Python path includes: {project_root}")
|
|
|
|
print("\n1. Testing basic imports...")
|
|
try:
|
|
import flask
|
|
print(f" ✅ Flask: {flask.__version__}")
|
|
except ImportError as e:
|
|
print(f" ❌ Flask missing: {e}")
|
|
return False
|
|
|
|
try:
|
|
from src.config_manager import ConfigManager
|
|
print(" ✅ ConfigManager imported")
|
|
except Exception as e:
|
|
print(f" ❌ ConfigManager failed: {e}")
|
|
traceback.print_exc()
|
|
return False
|
|
|
|
print("\n2. Testing web interface imports...")
|
|
try:
|
|
from web_interface.app import app
|
|
print(" ✅ web_interface.app imported")
|
|
print(f" 📋 App object: {app}")
|
|
except Exception as e:
|
|
print(f" ❌ web_interface.app failed: {e}")
|
|
traceback.print_exc()
|
|
return False
|
|
|
|
print("\n3. Checking config...")
|
|
try:
|
|
config_manager = ConfigManager()
|
|
config = config_manager.load_config()
|
|
print(" ✅ Config loaded")
|
|
|
|
autostart = config.get('web_display_autostart', False)
|
|
print(f" 🔧 web_display_autostart: {autostart}")
|
|
except Exception as e:
|
|
print(f" ❌ Config check failed: {e}")
|
|
traceback.print_exc()
|
|
return False
|
|
|
|
print("\n4. Testing Flask startup...")
|
|
try:
|
|
print(" 🚀 Starting Flask app...")
|
|
print(" 📍 Will run on: http://0.0.0.0:5000")
|
|
print(" ⏹️ Press Ctrl+C to stop")
|
|
|
|
# Run the app (debug mode controlled by env var to satisfy security scanners)
|
|
_debug = os.environ.get('LEDMATRIX_FLASK_DEBUG', '0') == '1'
|
|
app.run(host='0.0.0.0', port=5000, debug=_debug)
|
|
|
|
except KeyboardInterrupt:
|
|
print("\n ⏹️ Server stopped by user")
|
|
return True
|
|
except Exception as e:
|
|
print(f" ❌ Flask startup failed: {e}")
|
|
traceback.print_exc()
|
|
return False
|
|
|
|
if __name__ == "__main__":
|
|
try:
|
|
success = main()
|
|
if success:
|
|
print("\n✅ Debug completed successfully")
|
|
else:
|
|
print("\n❌ Debug found issues - check output above")
|
|
except Exception as e:
|
|
print(f"\n💥 Debug script crashed: {e}")
|
|
traceback.print_exc()
|