Skip to content

Commit 43cbe0d

Browse files
authored
fix(agent): skip site dirs that have bad .pth files (#167)
1 parent 27bc755 commit 43cbe0d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/isolate/connections/_local/agent_startup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import runpy
77
import site
88
import sys
9+
import traceback
910

1011

1112
def load_pth_files() -> None:
@@ -28,7 +29,13 @@ def load_pth_files() -> None:
2829
# will need to be fixed once we are dealing with more than 2 nodes and editable
2930
# packages.
3031
for site_dir in python_path.split(os.pathsep):
31-
site.addsitedir(site_dir)
32+
try:
33+
site.addsitedir(site_dir)
34+
except Exception:
35+
# NOTE: there could be .pth files that are model weights and not
36+
# python path configuration files.
37+
traceback.print_exc()
38+
print(f"Error adding site directory {site_dir}, skipping...")
3239

3340

3441
def main():

0 commit comments

Comments
 (0)