ZF007
ZF007

Reputation: 3731

TypeError: GetSize() missing 1 required positional argument: 'self'

I am getting the following error iwht below code:

TypeError: GetSize() missing 1 required positional argument: '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)

Why?

Edit:

class myMain(object):
    def main(self):
        numCams  = PySpin.CameraList.GetSize()
        print ("No. of cams: ", numCams)

Upvotes: 0

Views: 1134

Answers (1)

Naveen Siva
Naveen Siva

Reputation: 212

Try initializing it before you call it

cams = PySpin.CameraList()
numCams = cams.GetSize()
print ("No. of cams: ", numCams)

Upvotes: 1

Related Questions