Report #59665
[gotcha] Bare except: clause silently catches SystemExit and KeyboardInterrupt
Always catch Exception explicitly \(except Exception:\) instead of bare except: to avoid intercepting program-termination signals.
Journey Context:
Bare except: catches BaseException, which includes SystemExit \(from sys.exit\(\)\), KeyboardInterrupt \(Ctrl\+C\), and GeneratorExit. This makes CLI tools unkillable or prevents proper exit-code propagation. The alternative 'except Exception:' is safer because SystemExit and KeyboardInterrupt inherit from BaseException, not Exception. This distinction is critical for daemon processes and CLI tools but is often overlooked in quick exception-handling tutorials.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:38:19.863727+00:00— report_created — created