{"id":9746,"library":"flake8-blind-except","title":"flake8-blind-except","description":"flake8-blind-except is a `flake8` extension that identifies \"blind\" `except:` statements in Python code, specifically bare `except:` or `except Exception:` without logging or re-raising. It helps enforce better error handling practices by flagging these broad catches. The current version is 0.2.1, and its release cadence is slow, indicating a mature and stable plugin.","status":"active","version":"0.2.1","language":"en","source_language":"en","source_url":"https://github.com/elijahandrews/flake8-blind-except","tags":["flake8","linter","code quality","error handling"],"install":[{"cmd":"pip install flake8-blind-except","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"This library is a plugin for flake8 and requires flake8 to be installed to function.","package":"flake8","optional":false}],"imports":[],"quickstart":{"code":"# 1. Install flake8 and the plugin\n# pip install flake8 flake8-blind-except\n\n# 2. Create a Python file with a blind except (e.g., my_module.py)\n# with open('my_module.py', 'w') as f:\n#     f.write(\"\"\"try:\\n    1/0\\nexcept:\\n    pass # This will trigger B902\\n\"\"\")\n\n# 3. Run flake8 on the file\n# This command will output the B902 error for the blind except\n# flake8 my_module.py","lang":"python","description":"To quickly verify `flake8-blind-except`, install both `flake8` and the plugin. Then, create a simple Python file containing a bare `except:` statement. Running `flake8` against this file will demonstrate the plugin's `B902` error detection."},"warnings":[{"fix":"Ensure `pip install flake8` is run in your environment alongside `flake8-blind-except`.","message":"As a `flake8` plugin, `flake8-blind-except` relies on `flake8` itself being installed and correctly configured. Ensure `flake8` is installed in the same environment.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review your `flake8` configuration to ensure `B902` is not explicitly ignored and that no `select` directive is preventing its execution.","message":"Existing `flake8` configuration files (e.g., `pyproject.toml`, `setup.cfg`, `.flake8`) can override which checks are run. If `B902` errors are not showing up, check your `ignore` or `select` directives.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For more rigorous error handling checks, consider additional `flake8` plugins or custom rules that analyze exception types and handling logic more deeply.","message":"The plugin specifically targets 'blind' excepts (bare `except:` or `except Exception:`). It does not flag more specific but still overly broad catches like `except BaseException:`, which may still hide important errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Install `flake8` and `flake8-blind-except` together: `pip install flake8 flake8-blind-except`.","cause":"The `flake8` package, which is necessary to run `flake8-blind-except`, is not installed or not available in the current shell's PATH.","error":"flake8: command not found"},{"fix":"First, verify installation with `pip show flake8-blind-except`. Then, check your `flake8` configuration files (e.g., `pyproject.toml`, `setup.cfg`, `.flake8`) for `ignore = B902` or `select = ...` directives.","cause":"`flake8-blind-except` might not be installed, or your `flake8` configuration is explicitly ignoring `B902` or selecting a limited set of checks that exclude it.","error":"No B902 errors reported, even with blind `except:` statements in code."},{"fix":"Upgrade `flake8-blind-except` to version 0.2.1 or newer: `pip install --upgrade flake8-blind-except`.","cause":"Older versions of `flake8-blind-except` (prior to 0.2.1) incorrectly listed `setuptools` in `install_requires`, which could lead to installation issues in some minimal environments.","error":"ModuleNotFoundError: No module named 'setuptools'"}]}