我在下面的代码中收到以下错误:
TypeError:GetSize() 缺少 1 个必需的位置参数:'self'
import PySpin
system = PySpin.System.GetInstance()
cam_list = system.GetCameras()
# This works:
numCams = cam_list.GetSize()
# this fails:
numCams = PySpin.CameraList.GetSize()
print ("No. of cams: ", numCams)
为什么?
编辑:
class myMain(object):
def main(self):
numCams = PySpin.CameraList.GetSize()
print ("No. of cams: ", numCams)