pylint-errors

E0701 (bad-except-order)

:x: Problematic code:

try:
    # if the line below raises TypeError then this won't reach
    # never by block with this exception and will be caught by Exception 
    print(int(input()))
except Exception:
    raise
except TypeError:
    raise

:heavy_check_mark: Correct code:

try:
    print(int(input()))
except TypeError:
    raise
except Exception:
    raise

Rationale:

Used when except clauses are not in the correct order (from the more specific to the more generic). If you don’t fix the order, some exceptions may not be caught by the most specific handler.