diff --git a/main.py b/main.py index 4b87309..ffedd40 100644 --- a/main.py +++ b/main.py @@ -11,10 +11,18 @@ import sys import multiprocessing from pathlib import Path -# CRITICAL: Must be called before anything else on Windows with PyInstaller +# CRITICAL: Must be called before anything else with PyInstaller # This prevents the infinite spawning loop when the frozen executable runs -if sys.platform == 'win32': - multiprocessing.freeze_support() +# Required on all platforms (Windows, Linux, macOS) when using multiprocessing +multiprocessing.freeze_support() + +# Set multiprocessing start method to 'spawn' for consistency across platforms +# This prevents issues with PyInstaller frozen executables +if __name__ == "__main__": + try: + multiprocessing.set_start_method('spawn', force=True) + except RuntimeError: + pass # Already set, ignore # Add project root to Python path project_root = Path(__file__).parent