Skip to content

Commit 42b38b2

Browse files
fix: ensure providers/*.py are importable in zipped/embedded Python builds
1 parent b3130f9 commit 42b38b2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎proxy.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,13 @@ def _context_length_hint(detail):
286286
except Exception:
287287
UC_MODEL_MAP = {}
288288

289+
# Ensure sibling modules (providers/*.py) are importable even when the
290+
# interpreter's default sys.path[0] does not point here (e.g. zipped/embedded
291+
# Python builds). This is a no-op when the script dir is already on sys.path.
292+
_HERE = os.path.dirname(os.path.abspath(__file__))
293+
if _HERE not in sys.path:
294+
sys.path.insert(0, _HERE)
295+
289296
# Optional Codex/ChatGPT OAuth helper (only needed for "codex_oauth" routes).
290297
try:
291298
from providers import codex_oauth as _codex_oauth # type: ignore

0 commit comments

Comments
 (0)