【发布时间】:2019-03-05 12:13:13
【问题描述】:
我有两个类,在第一个类中,我创建了第二个类的一个实例,然后执行第二个类的一个方法,一个启动进程的方法。
t1.py
test = "t1"
def executeBase():
base = baseNode.BaseNode()
baseNode.BaseNode.executeBase(test, base) #error
和baseNode.py
class BaseNode():
def __init__(self):
self.eui48 = "01:00:00:00:00:00"
self.port = 7919
def executeBase(self, test, base):
#I execute here a process
我在一行中遇到错误 (#error)。
File "/testbench/testbenchPython/test/t1.py", line 20, in executeBase
baseNode.BaseNode.executeBase(test, base)
TypeError: executeBase() missing 1 required positional argument: 'base'
不能这样做吗?如果是,有什么问题,我该如何纠正? 我尝试以不同的方式传递参数,但没有找到解决方案。
非常感谢!
【问题讨论】:
标签: python object arguments instance