From 440646f4c9b3172fb0f36821a035d9b9a0bc1c9e Mon Sep 17 00:00:00 2001 From: haosenwang1018 Date: Wed, 25 Feb 2026 10:36:10 +0000 Subject: [PATCH] fix: replace bare except clauses with except Exception Bare `except:` catches BaseException including KeyboardInterrupt and SystemExit. Replaced 3 instances with `except Exception:`. --- wan/modules/animate/preprocess/pose2d_utils.py | 2 +- wan/modules/animate/preprocess/process_pipepline.py | 2 +- wan/modules/animate/preprocess/utils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wan/modules/animate/preprocess/pose2d_utils.py b/wan/modules/animate/preprocess/pose2d_utils.py index 7d74e11..1bed87e 100644 --- a/wan/modules/animate/preprocess/pose2d_utils.py +++ b/wan/modules/animate/preprocess/pose2d_utils.py @@ -24,7 +24,7 @@ def read_img(image, convert='RGB', check_exist=False): img = Image.open(image) if convert: img = img.convert(convert) - except: + except Exception: raise IOError('File error: ', image) return np.asarray(img) else: diff --git a/wan/modules/animate/preprocess/process_pipepline.py b/wan/modules/animate/preprocess/process_pipepline.py index 296d214..2ded656 100644 --- a/wan/modules/animate/preprocess/process_pipepline.py +++ b/wan/modules/animate/preprocess/process_pipepline.py @@ -9,7 +9,7 @@ from PIL import Image try: import moviepy.editor as mpy -except: +except Exception: import moviepy as mpy from decord import VideoReader diff --git a/wan/modules/animate/preprocess/utils.py b/wan/modules/animate/preprocess/utils.py index 7373fb5..989a3cb 100644 --- a/wan/modules/animate/preprocess/utils.py +++ b/wan/modules/animate/preprocess/utils.py @@ -137,7 +137,7 @@ def resize_by_area(image, target_area, keep_aspect_ratio=True, divisor=64, paddi h, w = image.shape[:2] try: new_w, new_h = calculate_new_size(w, h, target_area, divisor) - except: + except Exception: aspect_ratio = w / h if keep_aspect_ratio: