python
runtime_error
ai_generated
true
NotImplementedError
ID: python/notimplementederror
90%Fix Rate
90%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 311 | active | — | — | — |
Root Cause
Abstract method not implemented in subclass. The parent class requires you to override this method.
genericWorkarounds
-
95% success Implement the method in your subclass with the correct signature
class MySubclass(BaseClass): def required_method(self, arg): # Match parent's signature exactly return self.process(arg)Sources: https://docs.python.org/3/library/abc.html#abc.abstractmethod
-
85% success If you don't need this method, provide a no-op: def method(self): pass
def method(self): pass
Sources: https://docs.python.org/3/library/exceptions.html#NotImplementedError
Dead Ends
Common approaches that don't work:
-
Call super() to use parent implementation
85% fail
Parent raises NotImplementedError — there is no implementation to call
-
Remove the abstract method from parent
70% fail
Other subclasses may depend on the abstract contract
Error Chain
Preceded by: