forked from extern/easydiffusion
Merge pull request #1560 from JeLuF/mdir-err
Error handling for models_dir
This commit is contained in:
commit
8436e8a71e
@ -104,7 +104,9 @@ def init():
|
|||||||
warnings.filterwarnings("ignore", category=UserWarning, message="TypedStorage is deprecated")
|
warnings.filterwarnings("ignore", category=UserWarning, message="TypedStorage is deprecated")
|
||||||
|
|
||||||
config = getConfig()
|
config = getConfig()
|
||||||
MODELS_DIR = config.get("models_dir", MODELS_DIR)
|
config_models_dir = config.get("models_dir", None)
|
||||||
|
if (config_models_dir is not None and config_models_dir != ""):
|
||||||
|
MODELS_DIR = config_models_dir
|
||||||
|
|
||||||
|
|
||||||
def init_render_threads():
|
def init_render_threads():
|
||||||
|
@ -261,7 +261,24 @@ def make_model_folders():
|
|||||||
for model_type in KNOWN_MODEL_TYPES:
|
for model_type in KNOWN_MODEL_TYPES:
|
||||||
model_dir_path = os.path.join(app.MODELS_DIR, model_type)
|
model_dir_path = os.path.join(app.MODELS_DIR, model_type)
|
||||||
|
|
||||||
os.makedirs(model_dir_path, exist_ok=True)
|
try:
|
||||||
|
os.makedirs(model_dir_path, exist_ok=True)
|
||||||
|
except Exception as e:
|
||||||
|
from rich.console import Console
|
||||||
|
from rich.panel import Panel
|
||||||
|
|
||||||
|
Console().print(
|
||||||
|
Panel(
|
||||||
|
"\n"
|
||||||
|
+ f"Error while creating the models directory: '{model_dir_path}'\n"
|
||||||
|
+ f"Error: {e}\n\n"
|
||||||
|
+ f"[white]Check the 'models_dir:' line in the file '{os.path.join(app.ROOT_DIR, 'config.yaml')}'.[/white]\n",
|
||||||
|
title="Fatal Error starting Easy Diffusion",
|
||||||
|
style="bold yellow on red",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
input("Press Enter to terminate...")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
help_file_name = f"Place your {model_type} model files here.txt"
|
help_file_name = f"Place your {model_type} model files here.txt"
|
||||||
help_file_contents = f'Supported extensions: {" or ".join(MODEL_EXTENSIONS.get(model_type))}'
|
help_file_contents = f'Supported extensions: {" or ".join(MODEL_EXTENSIONS.get(model_type))}'
|
||||||
|
Loading…
Reference in New Issue
Block a user