From 4d6dd6d35dfb2c3178cda8ec86a88fcf9afeee3d Mon Sep 17 00:00:00 2001 From: jknapp Date: Sun, 28 Dec 2025 19:57:13 -0800 Subject: [PATCH] Include pvporcupine resource files in PyInstaller build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PyInstaller wasn't bundling pvporcupine's resource files (keyword_files and lib directories), causing a FileNotFoundError at runtime when pvporcupine tried to access its resources directory. Changes: - Added code to detect and include pvporcupine resources and lib folders - Falls back gracefully if pvporcupine is not installed - Resources are bundled even though we don't use wake word features (pvporcupine initializes and checks for these on import) This fixes the runtime error: FileNotFoundError: [WinError 3] The system cannot find the path specified: '...\pvporcupine\resources/keyword_files\windows' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- local-transcription.spec | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/local-transcription.spec b/local-transcription.spec index f875afb..337dab9 100644 --- a/local-transcription.spec +++ b/local-transcription.spec @@ -18,12 +18,26 @@ import faster_whisper faster_whisper_path = os.path.dirname(faster_whisper.__file__) vad_assets_path = os.path.join(faster_whisper_path, 'assets') +# Find pvporcupine resources folder (needed even though we don't use wake words) +try: + import pvporcupine + pvporcupine_path = os.path.dirname(pvporcupine.__file__) + pvporcupine_resources = os.path.join(pvporcupine_path, 'resources') + pvporcupine_lib = os.path.join(pvporcupine_path, 'lib') + pvporcupine_data_files = [] + if os.path.exists(pvporcupine_resources): + pvporcupine_data_files.append((pvporcupine_resources, 'pvporcupine/resources')) + if os.path.exists(pvporcupine_lib): + pvporcupine_data_files.append((pvporcupine_lib, 'pvporcupine/lib')) +except ImportError: + pvporcupine_data_files = [] + # Base configuration binaries = [] datas = [ ('config/default_config.yaml', 'config'), (vad_assets_path, 'faster_whisper/assets'), # Include VAD model -] +] + pvporcupine_data_files # Include pvporcupine resources hiddenimports = [ 'PySide6.QtCore', 'PySide6.QtWidgets',