Closed sagregrevc closed 5 months ago
Standard way to solve your use-case is like this:
import pypylon.pylon as py
tlFactory = py.TlFactory.GetInstance()
# Get all attached devices and exit application if no device is found.
devices = tlFactory.EnumerateDevices()
class CamWrapper:
def __init__(self, device : py.DeviceInfo):
self.camera_obj = py.InstantCamera(
tlFactory.CreateDevice(device)
)
self.camera_obj.Open()
def __del__(self):
self.camera_obj.Close()
def __str__(self):
return f"CamWrapper <{self.camera_obj.DeviceInfo.GetFriendlyName()}>"
Select one of the cameras from the list of devices:
cam = CamWrapper(devices[0])
print(cam)
CamWrapper <Basler a2A4508-6gcPRO (40271242)>
del(cam)
seems reason was in my code. cameras sn was processed by different way in different parts of code
Describe what you want to implement and what the issue & the steps to reproduce it are:
I try to find all sn of all connected devices. than I would like to close it.
after I would like make class with some of this cameras. but camera cannot be reached
Is your camera operational in Basler pylon viewer on your platform
Yes
Hardware setup & camera model(s) used
x64, win10, 8Gb, USB3, 1m
Runtime information:
how I can close transport layer if I dont have object ?