#!/usr/bin/env python3 """ main.py — Financial Analyzer entry point. Run: python main.py """ import sys, io, os from pathlib import Path # Force UTF-8 on Windows so log messages with unicode chars (→ ✓ ✗) don't crash if sys.platform == "win32": os.environ["PYTHONIOENCODING"] = "utf-8" try: sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace") sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding="utf-8", errors="replace") except AttributeError: pass # Make sure local packages resolve correctly sys.path.insert(0, str(Path(__file__).parent)) from storage.cache import init_db def main(): # Ensure DB exists init_db() try: from gui.app_window import AppWindow except ImportError as e: print(f"ERROR: Could not import GUI: {e}") print("Make sure you have installed dependencies:") print(" pip install customtkinter Pillow requests beautifulsoup4 lxml") print(" pip install python-dotenv google-generativeai anthropic openpyxl python-docx pandas") sys.exit(1) app = AppWindow() app.mainloop() if __name__ == "__main__": main()