From c2373c3ed615339098626fefd385a54e08ad10fd Mon Sep 17 00:00:00 2001 From: SekiDesu0 Date: Fri, 15 May 2026 05:12:06 -0400 Subject: [PATCH] modified: app.py --- .vscode/settings.json | 2 +- app.py | 12 +++++++++++- app.spec | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index a456028..c9ebf2d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "python-envs.defaultEnvManager": "ms-python.python:pyenv" + "python-envs.defaultEnvManager": "ms-python.python:system" } \ No newline at end of file diff --git a/app.py b/app.py index 38bbe19..f2fa90c 100644 --- a/app.py +++ b/app.py @@ -16,6 +16,14 @@ import io import webview import threading +# --- PYINSTALLER WINDOWED MODE FIX --- +# If running as a compiled exe, redirect stdout/stderr so Flask doesn't crash +if getattr(sys, 'frozen', False) and sys.platform == "win32": + # Force output to a real file instead of the console + log_file = os.path.join(os.path.dirname(sys.executable), 'seki_crash.log') + sys.stdout = open(log_file, 'w', encoding='utf-8') + sys.stderr = sys.stdout + # from dotenv import load_dotenv # load_dotenv() @@ -785,7 +793,8 @@ def delete_gasto(gasto_id): def start_server(): # Use socketio.run instead of default app.run - socketio.run(app, host='127.0.0.1', port=5000) + #socketio.run(app, host='127.0.0.1', port=5000) + socketio.run(app, host='127.0.0.1', port=5000, log_output=False, allow_unsafe_werkzeug=True) def run_standalone(): t = threading.Thread(target=start_server) @@ -802,6 +811,7 @@ def run_standalone(): webview.start(private_mode=False) if __name__ == '__main__': + init_db() # For standalone desktop app with embedded browser, use diff --git a/app.spec b/app.spec index fe19c55..95d5ce0 100644 --- a/app.spec +++ b/app.spec @@ -26,7 +26,7 @@ exe = EXE( bootloader_ignore_signals=False, strip=False, upx=True, - console=True, + console=False, disable_windowed_traceback=False, argv_emulation=False, target_arch=None,