mirror of
https://github.com/openvinotoolkit/stable-diffusion-webui.git
synced 2024-12-15 15:13:45 +03:00
fix to make scripts that failed to compile not crash the program
This commit is contained in:
parent
226de5e503
commit
e67a56dbb4
@ -41,6 +41,7 @@ def load_scripts(basedir):
|
|||||||
with open(path, "r", encoding="utf8") as file:
|
with open(path, "r", encoding="utf8") as file:
|
||||||
text = file.read()
|
text = file.read()
|
||||||
|
|
||||||
|
try:
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
compiled = compile(text, path, 'exec')
|
compiled = compile(text, path, 'exec')
|
||||||
module = ModuleType(filename)
|
module = ModuleType(filename)
|
||||||
@ -52,6 +53,9 @@ def load_scripts(basedir):
|
|||||||
obj.filename = path
|
obj.filename = path
|
||||||
|
|
||||||
scripts.append(obj)
|
scripts.append(obj)
|
||||||
|
except Exception:
|
||||||
|
print(f"Error loading script: {filename}", file=sys.stderr)
|
||||||
|
print(traceback.format_exc(), file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
def wrap_call(func, filename, funcname, *args, default=None, **kwargs):
|
def wrap_call(func, filename, funcname, *args, default=None, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user