我有两个类,在第一个类中,我创建第二个类的一个实例,并执行第二个类的一个方法,一个启动进程的方法。在
t1.py型
test = "t1"
def executeBase():
base = baseNode.BaseNode()
baseNode.BaseNode.executeBase(test, base) #error
以及baseNode.py在
^{pr2}$我在行中得到了错误。在
File "/testbench/testbenchPython/test/t1.py", line 20, in executeBase
baseNode.BaseNode.executeBase(test, base)
TypeError: executeBase() missing 1 required positional argument: 'base'
这不可能吗?如果是,问题是什么?我如何纠正它? 我试过用不同的方法来传递论点,但没有找到解决办法。在
非常感谢!在
您应该在实例。试试这个:
在这种情况下
def executeBase(): base = baseNode.BaseNode() baseNode.BaseNode.executeBase(test, base) #error
我猜executeBase()func在找self!代替
baseNode.BaseNode.executeBase(test, base) #error
这一行可以base.executeBase(test,base)
相关问题 更多 >
编程相关推荐