The “correct” way to define an exception in Python without PyLint complaining

When you call super, you need the subclass/derived class as the first argument, not the main/base class.

From the Python online documentation:

class C(B):
    def method(self, arg):
        super(C, self).method(arg)

So your exception would be defined as follows:

class MyException(Exception):
    def __init__(self, message):
        super(MyException, self).__init__(message)
        self.message = message

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)