You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If this was inside a function/method where the except block interrupts the control flow to bail from said function for good, it'd make sense. But not on the module level, where the exception is suppressed, and an alternative is provided. In this case, else: is vital since it usually shouldn't be executed regardless (it's not a finally:, after all).
In general, the check seems to be confused about the context of the else-block. This rule would mostly make sense where all except blocks escape the control flow (or continue an external loop, or something like that).
How it should be
This should not trigger a rule violation.
Flake8 version and plugins
N/A
pip information
N/A
OS information
N/A
The text was updated successfully, but these errors were encountered:
What's wrong
There is a common pattern of falling back to back-up modules when imports fail.
Here's what I mean:
If this was inside a function/method where the except block interrupts the control flow to bail from said function for good, it'd make sense. But not on the module level, where the exception is suppressed, and an alternative is provided. In this case,
else:
is vital since it usually shouldn't be executed regardless (it's not afinally:
, after all).In general, the check seems to be confused about the context of the
else
-block. This rule would mostly make sense where allexcept
blocks escape the control flow (orcontinue
an external loop, or something like that).How it should be
This should not trigger a rule violation.
Flake8 version and plugins
N/A
pip information
N/A
OS information
N/A
The text was updated successfully, but these errors were encountered: