Impossible to get stream methods to work in recent installation of CVBpy

Hello,

I have been using CVBpy on another computer since last summer without any problem. I have tried to replicate the setup on a new computer for a new project and it seems that the stream object does not have its usual associated methods, e.g. start() or get_snapshot().

I have installed CVB version 13.04.001 and then pip-installed the cvb python package v.1.4 from the wheel provided in Lib/Python. Everything works fine for the install and I can do pip import cvb without any error in a python console.

I can also create a stream object with

vin_device = cvb.DeviceFactory.open(cvb.install_path() + "/drivers/GenICam.vin")
stream = vin_device.stream

(no error)

However when I try to call the methods of the stream, they dont seem to exist. For example:

stream.start()

raises an AttributeError: ā€˜builtin_function_or_methodā€™ object has no attribute ā€˜startā€™. Same for get_snapshot() etc. When I do dir(stream), I donā€™t see any public methods.

Any idea what could be wrong here?

Thank you very much in advance,

Olivier

Just change it from ā€œstream.start()ā€ to ā€œstream().start()ā€
See https://help.commonvisionblox.com/NextGen/14.0/cvbpy/d3/d2d/classcvb_1_1_device.html

1 Like

Indeed, this works, thank you very much! At which version of cvb did the change occur? And any idea why? I could not figure out how to get the documentation for several versions of cvbpy ā€¦

Not sure about which versionā€¦but I was as surprised as youā€¦after this summer my code didnā€™t work and I was lucky to find the solution pretty fast. The product is great but the Python documentation is terriblešŸ˜Š. I donā€™t think there are many Python developers using the SDK? Correct if Iā€™m wrongā€¦

I agree that the python documentation is quite obscure. Hopefully it will get improved as more users develop with this package!

Hi @ovinc, hi @johang

sorry you ran into that change. We hand to change device.stream to device.stream() staring at version 13.04.000 because we want support multi stream devices and different kind of streams. So device.stream() can now take arguments.

Thank you for your feedback regarding the documentation. We are aware of this and will improve it step by step. We definitely want to give python developers a good user experience. FYI beginning with version 13.04.000 we also started to provide a stubfile to enable type hints. E.g. VS Code with Pylance should therefore highlight the change.

Be aware that

stream().start()

can dangerous, as the stream is automatically stopped when it is destroyed. In the above spinet it is not clear if stream is kreppt alive.

1 Like

Andreas, does that mean that you could have 2 processes connecting to the camera to receive streams ?

Hi @antonkristensen,

pretty sure Andreas was referencing cameras, that offer their data via multiple streams. I.e. for example a 3D camera, which offers 1 stream for itā€™s depth data/point cloud and 1 stream which offers the confidence data. But which cameras offer multiple streams is not tied to 3D, this could be anything.

If you need the same stream in multiple processes, that can be solved via multicast for example.

But what is your Use-Case?