From ae88412aaecf7fc2bc6482ac9d3e8c923d26bd62 Mon Sep 17 00:00:00 2001 From: David Strouk Date: Sun, 4 May 2025 17:04:08 +0300 Subject: [PATCH] Update modules/processors/frame/face_swapper.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --- modules/processors/frame/face_swapper.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/processors/frame/face_swapper.py b/modules/processors/frame/face_swapper.py index 531faa7..59e3a59 100644 --- a/modules/processors/frame/face_swapper.py +++ b/modules/processors/frame/face_swapper.py @@ -31,8 +31,12 @@ def pre_check() -> bool: # Use models_dir instead of abs_dir to save to the correct location download_directory_path = models_dir - # Make sure the models directory exists - os.makedirs(download_directory_path, exist_ok=True) + # Make sure the models directory exists, catch permission errors if they occur + try: + os.makedirs(download_directory_path, exist_ok=True) + except PermissionError as e: + logging.error(f"Failed to create directory {download_directory_path} due to permission error: {e}") + return False # Use the direct download URL from Hugging Face conditional_download(