# Entry point of the bundled myGarmin.exe (PyInstaller). # No arguments: the app window. With arguments: the mygarmin command line (myGarmin.exe import ...); # the exe has no console, so its output goes to %LOCALAPPDATA%\myGarmin\cli.log. import os, sys if len(sys.argv) > 1: log = os.path.join(os.environ.get('LOCALAPPDATA', os.path.expanduser('~')), 'myGarmin', 'cli.log') os.makedirs(os.path.dirname(log), exist_ok=True) sys.stdout = sys.stderr = open(log, 'a', encoding='utf-8', buffering=1) print('>', ' '.join(sys.argv[1:])) from mygarmin.cli import main try: main(sys.argv[1:]) except SystemExit as e: if e.code not in (None, 0): print('exit:', e.code); raise except Exception: import traceback; traceback.print_exc(); sys.exit(1) else: from mygarmin.app import main main()