TypeError: Missing 1 required positional argument: 'self'

后端 未结 6 828
借酒劲吻你
借酒劲吻你 2020-11-22 02:18

I am new to python and have hit a wall. I followed several tutorials but cant get past the error:

Traceback (most recent call last):
  File \"C:\\Users\\Dom\         


        
6条回答
  •  礼貌的吻别
    2020-11-22 02:56

    You need to instantiate a class instance here.

    Use

    p = Pump()
    p.getPumps()
    

    Small example -

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

提交回复
热议问题