diff --git a/ui/easydiffusion/app.py b/ui/easydiffusion/app.py index abd003d1..43d0e3c4 100644 --- a/ui/easydiffusion/app.py +++ b/ui/easydiffusion/app.py @@ -104,7 +104,9 @@ def init(): warnings.filterwarnings("ignore", category=UserWarning, message="TypedStorage is deprecated") 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(): diff --git a/ui/easydiffusion/model_manager.py b/ui/easydiffusion/model_manager.py index 90daadba..f6e1e2d0 100644 --- a/ui/easydiffusion/model_manager.py +++ b/ui/easydiffusion/model_manager.py @@ -261,7 +261,24 @@ def make_model_folders(): for model_type in KNOWN_MODEL_TYPES: 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_contents = f'Supported extensions: {" or ".join(MODEL_EXTENSIONS.get(model_type))}'