error "ValueError('failed to load device object)"

I am trying to access a camera through the python API, using Acquire from a Camera (Getting Started with CVBpy).

All the examples (image, emu camera) works fine but the one to access the camera.

I am using Visual Studio 2017 with Anaconda 5.2 (Python 3.6) with files manually copied to “site-packages” because I didn’t know why anaconda doeans’t see the environmental path.

When running this line:

vin_device = + “/drivers/”)

I get the error:

ValueError: failed to load device object
Exception ignored in: <generator object using_format at 0x00000200606670A0>
Traceback (most recent call last):
File “D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Python\Core\Packages\ptvsd\”, line 859, in using_format
yield futures.Result(context())
SystemError: error return without exception set

I can access the device through CVB Management so the device is connected and accessible.

What can I do to fix it and connect to the device?


Hi @piotrM

This line works fine for me. So there must be something wrong elsewhere.
Are yous shure, that the device is not in use by some other process?
Please try this line outside your IDE, VS code might affect the environment needed to load drivers.

Regarding your error message:

This part is unrelated to CVBpy and probably caused by some special things in your setup.
I suggest to run this in a diffrent IDE e.g. Spyder. So you can seperate the errors.

If the error persists please conatct our support, providing CVB version and Python wrapper version.

Thanks for the quick answer! I was trying a different editor (Spyder) and it gave me the same error despite the camera being disconnected. Anyways I have tried reinstalling everything. Now whenever I try importing cvb python throws “Can’t load dll” error. I will try reinstalling everything yet again.

Thanks Andreas, it all works now. Apparently your CVB installator creates environmental variables that points to C:\ drive for some reason even in the I install it on another drive. After fixing that the python code works fine. It must have been something with the installation.

To use it in Visual Studio 2017 the option “Tools -> Options -> Python Tools -> General -> Ignore system-wide PYTHONPATH variables” needs to be deselected.

1 Like

Thanks for your feedback.

I’m aware the installation through the PYTHONPATH environment variable is not an optimal solution.
However, a quick and easy way to set it up as technical preview.

We are currently working on a better setup.