diff --git a/build_worker.spec b/build_worker.spec index e4abee1..1da9292 100644 --- a/build_worker.spec +++ b/build_worker.spec @@ -12,7 +12,9 @@ a = Analysis( [os.path.join(_project_root, 'worker', 'main.py')], pathex=[_project_root], binaries=[], - datas=[], + datas=[ + (os.path.join(_project_root, '1.py'), '.'), + ], hiddenimports=[ 'worker', 'worker.ws_client', diff --git a/worker/recruit_filter_sync.py b/worker/recruit_filter_sync.py index 16e11b8..5cece87 100644 --- a/worker/recruit_filter_sync.py +++ b/worker/recruit_filter_sync.py @@ -9,12 +9,20 @@ from __future__ import annotations import importlib.util import logging +import sys from functools import lru_cache from pathlib import Path from typing import Any, Dict, List, Optional -SCRIPT_ONE_PATH = Path(__file__).resolve().parent.parent / "1.py" +def _get_script_one_path() -> Path: + """Resolve 1.py path for both PyInstaller bundle and source runs.""" + if getattr(sys, '_MEIPASS', None): + return Path(sys._MEIPASS) / "1.py" + return Path(__file__).resolve().parent.parent / "1.py" + + +SCRIPT_ONE_PATH = _get_script_one_path() @lru_cache(maxsize=1)