Bug
In __init__.py line 35, importlib.import_module() is called outside the try/except block:
for file in files:
if not file.endswith(".py"):
continue
name = os.path.splitext(file)[0]
imported_module = importlib.import_module(".py.{}".format(name), __name__) # <-- outside try
try:
NODE_CLASS_MAPPINGS = {**NODE_CLASS_MAPPINGS, **imported_module.NODE_CLASS_MAPPINGS}
...
except:
pass
Impact
If any single .py module fails to import, the entire plugin fails to load and none of its nodes register. The except: pass was clearly intended to skip broken modules gracefully, but the import_module call isn't covered by it.
Reproduction
In the current main branch, color_name.py references find_best_match_by_similarity from imagefunc.py, but that function is not defined anywhere:
ImportError: cannot import name 'find_best_match_by_similarity' from 'comfyui_layerstyle.py.imagefunc'
This crashes the entire plugin — all 164+ nodes become unavailable, including unrelated ones like GaussianBlurV2, QWenImage2Prompt, etc.
Fix
Wrap the import_module call inside the existing try/except:
for file in files:
if not file.endswith(".py"):
continue
name = os.path.splitext(file)[0]
try:
imported_module = importlib.import_module(".py.{}".format(name), __name__)
NODE_CLASS_MAPPINGS = {**NODE_CLASS_MAPPINGS, **imported_module.NODE_CLASS_MAPPINGS}
...
except:
pass
This ensures that a broken module is silently skipped as originally intended, without taking down the rest of the plugin.
Environment
- ComfyUI latest
- Python 3.11
- ComfyUI_LayerStyle at
d94bef1 (current main HEAD)
Bug
In
__init__.pyline 35,importlib.import_module()is called outside thetry/exceptblock:Impact
If any single
.pymodule fails to import, the entire plugin fails to load and none of its nodes register. Theexcept: passwas clearly intended to skip broken modules gracefully, but theimport_modulecall isn't covered by it.Reproduction
In the current
mainbranch,color_name.pyreferencesfind_best_match_by_similarityfromimagefunc.py, but that function is not defined anywhere:This crashes the entire plugin — all 164+ nodes become unavailable, including unrelated ones like
GaussianBlurV2,QWenImage2Prompt, etc.Fix
Wrap the
import_modulecall inside the existingtry/except:This ensures that a broken module is silently skipped as originally intended, without taking down the rest of the plugin.
Environment
d94bef1(current main HEAD)