再次调用 och 函数时,报错:
self.och()
TypeError: 'Myoch' object is not callable
这是代码的一部分:
def opr(self):
path = File_location + "1_classes/" + self.lineEdit1.text() + '.txt'
try:
file = open(path)
except IOError as e:
self.och()
else:
self.uch()
och函数:
def och(self):
self.och = Myoch()
self.och.show()
如果你调用函数 och,然后在函数中给变量 och 命名,那么你还能期待什么呢?重命名一个函数或一个变量,永远不要再这样做!