Error when opening DeviceFactory: RuntimeError C-API call failed, LoadImageFileW


I am trying to connect a camera via the CVB Python wrapper.

When I start with the following simple Python code…

import cvb
GenICamDevice ="/Drivers/")

, I very often (and sometimes very persistently) get the following error message:

Traceback (most recent call last):

  File "<ipython-input-3-bcd6810e309b>", line 1, in <module>
    GenICamDevice ="/Drivers/")

RuntimeError: {C-API call failed} ({LoadImageFileW})

The installation was done according to the example in this forum. It has also already worked before, so the camera and / or installation seems principally correct.
Running the CVB Management Console shows, that the camera is working (sending images).

Can anybody help me, solving the problem? Do you need more information?

My system:
Win 10
Python 3.6.5 (run via Spyder)
Common Vision Blox Bindings 1.00.000 (x64)
CommonVisionBlox 13.01.006 (x64).exe
Camera (Dalsa Nano) connected via GigE and PoE injector

Hi Tom,

welcome to our forum.

One obvious question first:
When you run your code, are all other applications that could possibly block the driver closed (eg. ManagementConsole)?


Hi Chris,

Currently (after a complete restart) it’s working (with ManagementConsole closed).
But before I tried it both with and without ManagementConsole.

I figured that after startup of the computer, I can only run my test program after I had made a quick shot with the ManagementConsole before.
And after stopping a Python code, it can be only re-run without above error, after killing the Python interpreter.

Could it be that there are still processes running in the background? If so, can I identify them somehow?

Best wishes and thanks for your help,

Do you launch your application from autostart?

No, from within Spyder (Python IDE).

Hi @Tom

As the error says the call fails at the C-API level. Therefore it is most likely that it has nothing to do with Python in general.

But as you wrote:

Unfortunately that is quite common as Python and especially Spider is not very transparent about resource management. I suggest using the the “with” statement.

with as device:
  pass # do something with the device here, the device will be closed after you left the with scope

For a quick check if the device is accessible you can run GenICam Browser to discover devices, a red camera icon indicates that the device is currently inaccessible.

1 Like

Hi Andreas,

Opening with the “with” statement works without errors. So the problem is solved.


1 Like

I know it is late, but maybe it helps:
the connection needs to be closed properly for Python to reopen it later.

device = + "/drivers/")
img_stream =

this works fine for me


Thanks for the answer! I’ll try it ASAP (I currently don’t have access to the camera).

1 Like

pip install cython
work for me :wink: