Why do I get “TypeError: Missing 1 required positional argument: ‘self'”?

To use the class, first create an instance, like so:

p = Pump()
p.getPumps()

A full example:

>>> class TestClass:
...     def __init__(self):
...         print("init")
...     def testFunc(self):
...         print("Test Func")
... 
>>> testInstance = TestClass()
init
>>> testInstance.testFunc()
Test Func

Leave a Comment

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