except-pass (W8138)#
An except block only contains pass.
What it does#
Reports except blocks whose only statement is pass and that do not bind
the exception (except ... as e).
Why is this bad?#
The error disappears without a trace, which makes failures in production impossible to diagnose. Log it, or catch only the exception you expect.
Example#
try:
value = int(text)
except Exception:
pass
Use instead:
try:
value = int(text)
except ValueError:
_logger.debug("Not a number: %s", text)