From 3ba52b2c62ab5aeed08621b5dd3c9849aba4b467 Mon Sep 17 00:00:00 2001 From: scott Date: Thu, 16 Apr 2026 18:33:59 -0400 Subject: [PATCH] Fix PyInstaller spec: bundle modules as Python code not raw data Using datas to include modules/ caused stdlib imports (json etc.) to fail at runtime. Adding modules/ to pathex lets PyInstaller properly analyse and compile them into the bundle alongside the rest of the stdlib. Co-Authored-By: Claude Sonnet 4.6 --- es24n_conf.spec | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/es24n_conf.spec b/es24n_conf.spec index 3de198a..5405af5 100644 --- a/es24n_conf.spec +++ b/es24n_conf.spec @@ -1,15 +1,16 @@ # PyInstaller spec for es24n_conf Windows .exe # Build with: pyinstaller es24n_conf.spec +import os from PyInstaller.building.build_main import Analysis, PYZ, EXE +modules_dir = os.path.join(os.path.dirname(os.path.abspath(SPEC)), "modules") + a = Analysis( ["es24n_conf.py"], - pathex=[], + pathex=[modules_dir], binaries=[], - datas=[ - ("modules", "modules"), - ], + datas=[], hiddenimports=[ "serial", "serial.tools", @@ -35,7 +36,7 @@ exe = EXE( bootloader_ignore_signals=False, strip=False, upx=True, - console=True, # console app — must stay True for terminal UI + console=True, disable_windowed_traceback=False, target_arch=None, codesign_identity=None,