Skip to content

Commit 0d1c690

Browse files
committed
prevent warning for extensions without server modules
1 parent 0d5f811 commit 0d1c690

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llms/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3470,6 +3470,7 @@ def install_extensions():
34703470
sys.path.append(item_path)
34713471
try:
34723472
ctx = ExtensionContext(g_app, item_path)
3473+
module = None
34733474
init_file = os.path.join(item_path, "__init__.py")
34743475
if os.path.exists(init_file):
34753476
spec = importlib.util.spec_from_file_location(item, init_file)
@@ -3503,12 +3504,12 @@ def install_extensions():
35033504
ctx.register_ui_extension("index.mjs")
35043505

35053506
# include __load__ and __run__ hooks if they exist
3506-
load_func = getattr(module, "__load__", None)
3507+
load_func = getattr(module, "__load__", None) if module else None
35073508
if callable(load_func) and not inspect.iscoroutinefunction(load_func):
35083509
_log(f"Warning: Extension {item} __load__ must be async")
35093510
load_func = None
35103511

3511-
run_func = getattr(module, "__run__", None)
3512+
run_func = getattr(module, "__run__", None) if module else None
35123513
if callable(run_func) and inspect.iscoroutinefunction(run_func):
35133514
_log(f"Warning: Extension {item} __run__ must be sync")
35143515
run_func = None

0 commit comments

Comments
 (0)