diff --git a/core/pathex.py b/core/pathex.py index d5c40e2..d0766cd 100644 --- a/core/pathex.py +++ b/core/pathex.py @@ -52,6 +52,14 @@ def get_image_unique_filestem_paths(dir_path, verbose_print_func=None): return sorted(result) +def get_paths(dir_path): + dir_path = Path (dir_path) + + if dir_path.exists(): + return [ Path(x) for x in sorted([ x.path for x in list(scandir(str(dir_path))) ]) ] + else: + return [] + def get_file_paths(dir_path): dir_path = Path (dir_path) diff --git a/models/ModelBase.py b/models/ModelBase.py index 6c3388d..1102d64 100644 --- a/models/ModelBase.py +++ b/models/ModelBase.py @@ -95,7 +95,7 @@ class ModelBase(object): if is_rename: new_model_name = io.input_str(f"Enter new name of the model") - for filepath in pathex.get_file_paths(saved_models_path): + for filepath in pathex.get_paths(saved_models_path): filepath_name = filepath.name model_filename, remain_filename = filepath_name.split('_', 1)