# cvb.DeviceFactory.open error "ValueError('failed to load device object)"

**URL:** <https://forum.commonvisionblox.com/t/cvb-devicefactory-open-error-valueerror-failed-to-load-device-object/497>\
**Category:** Python API\
**Tags:** discovery, python\
**Created:** [July 25, 2018, 11:03am UTC](https://forum.commonvisionblox.com/t/cvb-devicefactory-open-error-valueerror-failed-to-load-device-object/497 "2018-07-25T11:03:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![piotrM](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@piotrM](https://forum.commonvisionblox.com/u/piotrM)\
**Post date:** [July 25, 2018, 11:03am UTC](https://forum.commonvisionblox.com/t/cvb-devicefactory-open-error-valueerror-failed-to-load-device-object/497/1 "2018-07-25T11:03:31Z")

</div>

Hi,  
I am trying to access a camera through the python API, using Acquire from a Camera ([https://forum.commonvisionblox.com/t/getting-started-with-cvbpy/241/5](https://forum.commonvisionblox.com/t/getting-started-with-cvbpy/241/5)).

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 = cvb.DeviceFactory.open(cvb.install\_path() + “/drivers/GenICam.vin”)
> 
> ![image](https://canada1.discourse-cdn.com/flex027/uploads/commonvisionblox/original/1X/f9d128afce129cc8bc704837b9fc6aec5a9de085.png)  
> 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\wrapper.py”, 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?

Thanks!

---

<div class="post-metadata">

**Author:** ![Andreas](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/andreas/32/75_2.png) [@Andreas](https://forum.commonvisionblox.com/u/Andreas)\
**Post date:** [July 25, 2018, 11:51am UTC](https://forum.commonvisionblox.com/t/cvb-devicefactory-open-error-valueerror-failed-to-load-device-object/497/2 "2018-07-25T11:51:12Z")

</div>

Hi @piotrM

> [@piotrM](#):
>
> vin\_device = cvb.DeviceFactory.open(cvb.install\_path() + “/drivers/GenICam.vin”)

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:

> [@piotrM](#):
>
> File “D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Python\Core\Packages\ptvsd\wrapper.py”, line 859, in using\_format  
> yield futures.Result(context())  
> SystemError: error return without exception set

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.

---

<div class="post-metadata">

**Author:** ![piotrM](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@piotrM](https://forum.commonvisionblox.com/u/piotrM)\
**Post date:** [July 25, 2018, 2:02pm UTC](https://forum.commonvisionblox.com/t/cvb-devicefactory-open-error-valueerror-failed-to-load-device-object/497/3 "2018-07-25T14:02:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![piotrM](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@piotrM](https://forum.commonvisionblox.com/u/piotrM)\
**Post date:** [July 26, 2018, 12:53pm UTC](https://forum.commonvisionblox.com/t/cvb-devicefactory-open-error-valueerror-failed-to-load-device-object/497/4 "2018-07-26T12:53:46Z")

</div>

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.

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

---

<div class="post-metadata">

**Author:** ![Andreas](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/andreas/32/75_2.png) [@Andreas](https://forum.commonvisionblox.com/u/Andreas)\
**Post date:** [July 26, 2018, 7:43pm UTC](https://forum.commonvisionblox.com/t/cvb-devicefactory-open-error-valueerror-failed-to-load-device-object/497/5 "2018-07-26T19:43:26Z")

</div>

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.
