Fix: utils package shadowed by comfy/utils.py

Change sys.path.insert(0, ...) to sys.path.append(...) to prevent the
comfy directory from being placed at the front of sys.path.

When comfy/ is at position 0, importing 'utils' finds comfy/utils.py
(a module file) instead of the top-level utils/ package, causing:
  ModuleNotFoundError: No module named 'utils.install_util'; 'utils' is not a package

This affects imports in app/frontend_management.py and app/database/db.py
which import from utils.install_util.

By using append() instead of insert(0, ...), the comfy directory is added
at the end of sys.path, preserving normal import resolution order.
This commit is contained in:
robotR 2026-01-10 23:51:19 +11:00
parent ec0a832acb
commit 1ce6474eaf

View File

@ -19,7 +19,7 @@ from PIL.PngImagePlugin import PngInfo
import numpy as np
import safetensors.torch
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy"))
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy"))
import comfy.diffusers_load
import comfy.samplers