This commit is contained in:
ddrwode
2026-03-06 11:35:34 +08:00
parent fdafeae1f5
commit 208e63e6f2
2 changed files with 12 additions and 2 deletions

View File

@@ -12,7 +12,9 @@ a = Analysis(
[os.path.join(_project_root, 'worker', 'main.py')], [os.path.join(_project_root, 'worker', 'main.py')],
pathex=[_project_root], pathex=[_project_root],
binaries=[], binaries=[],
datas=[], datas=[
(os.path.join(_project_root, '1.py'), '.'),
],
hiddenimports=[ hiddenimports=[
'worker', 'worker',
'worker.ws_client', 'worker.ws_client',

View File

@@ -9,12 +9,20 @@ from __future__ import annotations
import importlib.util import importlib.util
import logging import logging
import sys
from functools import lru_cache from functools import lru_cache
from pathlib import Path from pathlib import Path
from typing import Any, Dict, List, Optional 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) @lru_cache(maxsize=1)