Click to see the query in the CodeQL repository
If the class specified in an except handler (within a try statement) is not a legal exception class, then it will never match a raised exception and never be executed
Legal exception classes are:
Any old-style classes (Python 2 only)
Any subclass of the builtin class BaseException However, it recommended that you only use subclasses of the builtin class Exception (which is itself a subclass of BaseException).
Ensure that the specified class is the one intended. If it is not then replace it with the correct one. Otherwise the entire except block can be deleted.
Python Language Reference: Exceptions.
Python Tutorial: Handling Exceptions.