AttributeError: super object has no attribute __init__ in Python
Fix typos in the constructor call (use double underscores: super().__init__()) and ensure proper MRO inheritance order.
Root Cause Analysis
This error occurs when Python executes a class constructor and encounters an erroneous super() call, such as a typographical error (e.g. super().__int__() or super().init()), or when super() resolves to a class that does not define the target method.
1. Typographical Errors in Constructor Names
A frequent typo is writing super().__int__() (missing the second 'i') or super().init() (missing leading/trailing underscores). Because object defines __init__ but not __int__, Python raises AttributeError: 'super' object has no attribute '__int__'.
2. Invalid super() Arguments
In Python 3, writing zero-argument super() is standard. Passing incorrect class references (e.g. super(WrongClass, self)) causes super() to traverse to the wrong point in the Method Resolution Order (MRO).
3. Broken Diamond Multiple Inheritance Hierarchies
In multiple inheritance chains where a mixin class calls super().__init__() with specific keyword arguments that the next class in the MRO does not accept.
4. Custom Metaclass getattribute Overrides
Metaclasses that intercept attribute lookups on super proxies without delegating to type.__getattribute__.
Reproduction Code (MCVE)
class BaseComponent:
def __init__(self):
self.initialized = True
class ChildComponent(BaseComponent):
def __init__(self):
# Typo: __int__ instead of __init__
super().__int__()
ChildComponent()
Solution 1: Use Exact super().__init__() Syntax
Ensure double underscores are present before and after init: super().__init__().
class BaseComponent:
def __init__(self, name):
self.name = name
self.initialized = True
class ChildComponent(BaseComponent):
def __init__(self, name, priority=1):
super().__init__(name) # Clean zero-argument super
self.priority = priority
child = ChildComponent('DatabaseService', priority=10)
print(f'Initialized: {child.name}, priority={child.priority}')
Solution 2: Inspect Method Resolution Order (MRO) in Multiple Inheritance
Inspect Class.mro() to understand how super() delegates calls across cooperative inheritance hierarchies.
class A: pass
class B(A): pass
class C(B): pass
print('Method Resolution Order (MRO):')
for cls in C.mro():
print(f' - {cls.__name__}')
A common mistake is calling Base.__init__(self) explicitly instead of super().__init__(). Directly hardcoding parent class names breaks cooperative multiple inheritance and diamond hierarchies. Always use super(). Edge cases occur when mixing dataclasses with regular classes: @dataclass generates its own __init__; ensure __post_init__ is used when custom initialization is required. Contrast this error with TypeError: super() takes at least 1 argument (0 given), which only occurs in legacy Python 2.