How to Fix "TL Call Failed" Error When Running Python Code?

Hello everyone!
I’m new to the software and trying to run my program using Python, but I keep encountering the following error from the start:

device = cvb.DeviceFactory.open(cvb.install_path() + "Drivers/GenICam.vin")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: TL call failed

Here is my Python code:


import os
import cvb
 
device = cvb.DeviceFactory.open(cvb.install_path() + "Drivers/GenICam.vin")
img_stream = device.stream
img_stream.start()
img_stream.stop()
device.close()

Hi @Mo212 ,

First of all I want to say sorry for the delay here.
Lets jump right into solving your problem.
Have you tried the fix from this post?:

https://forum.commonvisionblox.com/t/cvb-devicefactory-open-error-valueerror-failed-to-load-device-object/497

In addition: instead of simply loading the GenICam.vin, you might want to use our discover interface to be a bit more flexible in which of the devices you actually want to open.
The code would look like this:

devices = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreTLs | cvb.DiscoverFlags.IgnoreGevSD)
with cvb.DeviceFactory.open(devices[0].access_token, cvb.AcquisitionStack.Vin) as device:
    test = "donothing"

At this point however, I would like to suggest to you to use our latest acquisitionstack (3rd gen).

The code for discorvering devices and loading them in this case looks like this:

devices = DeviceFactory.discover_from_root(DiscoverFlags.IgnoreVins) # or any other flag combination e.g.

devices = DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreVins | DiscoverFlags.IgnoreGevSD)

with DeviceFactory.open(devices[0].access_token, AcquisitionStack.GenTL) as device:

You can use the MigrationGuide for the Acquisition stacks:
https://help.commonvisionblox.com/NextGen/14.1/md_theory_of_operation_image_manager__migration_guide__acquisition_stack.html#py-discover-and-open

This is a very nice summary of the most important stept when getting started with programming in CVB for each of our language wrappers.

I hope this helps you with your application.
Cheers
Chris