From 769741b9e290b32f8f8a05b5457bb56cce876d89 Mon Sep 17 00:00:00 2001 From: Srikanth Patchava Date: Mon, 4 May 2026 19:02:58 -0700 Subject: [PATCH] fix: replace bare except with except Exception in analysis.py (#1502) Bare except clauses catch SystemExit and KeyboardInterrupt which prevents clean process termination. Use except Exception per PEP 8. Co-authored-by: Srikanth Patchava --- skills/datanalysis-credit-risk/references/analysis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skills/datanalysis-credit-risk/references/analysis.py b/skills/datanalysis-credit-risk/references/analysis.py index 2835fc7e..d6f9254f 100644 --- a/skills/datanalysis-credit-risk/references/analysis.py +++ b/skills/datanalysis-credit-risk/references/analysis.py @@ -483,7 +483,7 @@ def _calc_single_psi(args): # Bin based on non-NaN data (10 bins) try: bins = pd.qcut(train_nonan, q=10, duplicates='drop', retbins=True)[1] - except: + except Exception: bins = pd.cut(train_nonan, bins=10, retbins=True)[1] # Calculate proportion of each bin (including NaN bin) @@ -996,7 +996,7 @@ def export_cleaning_report(filepath: str, steps: list, try: wb = load_workbook(filepath) - except: + except Exception: wb = Workbook() wb.remove(wb.active)