Change RingBufferCount

i connected a device and before starting the stream i want to set the RingBufferCount.,0)

and i get this error : failed to extract type - resource might be gone
This also happens when i start an Acquisition and want to get the bufferindex:

image, status =



can you provide some more code to reproduce the error?

Please note that this usually happen when accessing already closed device resources.

import cvb

with, "Tutorial", "ClassicSwitch.emu")) as dev:
  # dev and all dependent resources like stream and ring buffer will only be available inside the with statement
  device = dev 
  # no error

# this will produce the above error

Im using this right now:

class Cameracontrol():
    The :class: Cameracontrol contains many functions to set up a camera in the genicam-standard via CVBpy.
    The functions can be divided into the following classes:
        1. setters for all used and useful nodes
        2. "useful" functions like starting/stopping Aquisition or acquiring images
    Before using this class u need to set the Ip-adress of your camera manually

    def __init__(self):
        self.device = None

    def _discover(self):
        Thos Function discovers all devices which are connected to the computer and returns
        a list with all of them in it.
        :return: a list with all devices. You may print() it to see details about the camera like ip-adress or model
        return cvb.DeviceFactory.discover_from_root(flags=cvb.DiscoverFlags.FindAll, time_span=300)

    def connect(self, ip: str):
        This function discovers all devices and connects to the the device with the given ip as a String
        :param ip: String of the ip-adress
        :return: The connected device
        disco = self._discover()
        for i in disco:
            if ip in i.access_token:

def startacquisition(self):
    # starts the Aquistion via grabber

def acquireimage(self):
    Starts the stream, sends a softwaretrigger to get an image and save it. After that the acqusition stops
    nodemap = self.device.node_maps["Device"]
    triggernode = nodemap["TriggerSoftware"]
    for i in range(10):
        image, status =
        if (image.buffer_index==2):
            print ("hallo")

With this class im running in my main:#

Camera = Cameracontrol()
Camera.device = Camera.connect('')


for i in range (0,10):
    image, status = stream.wait()
    if image.buffer_index == 1:'image%d.png' %(i))

this after connecting to the device works though in a separate program

I solved the problem myself. I needed to create varibales with a = to save the cahnges made.
Is there another way to accomplish this?

Thanks for the feedback.
Can you please post some details about the difference between your working soulution and the error message above.
I’m still quite puzzled about what you actually changed?


Hi there
I have a similar problem with a 3d camera:
3D Vendor: LMI
3D Model: Gocator 2420
3D Version:

I am using python and Pycharm and the latest CVb software. After setting the number of buffers to 3, or 10 or 100 or 1000 after the last buffer image (if buffer size = 3, at image 4) i get (i have removed a try catch to find the error):

Traceback (most recent call last):
  File "C:/Users/User/PycharmProjects/base-valve/", line 816, in run
    np_array3D = cvb.as_array(image3D)
  File "C:\Users\User\AppData\Local\conda\conda\envs\base-valve\lib\site-packages\cvb\", line 281, in as_array
    if not image.plane_data_types_identical:
RuntimeError: failed to extract type -  resource might be gone

I am using two cameras (the other one a Jai GO-5000M-PGE, no problem with it at any buffer size).
I have optimized the network card setting as per instructions to maximize performance on both cards. The 3D camera is using the GenTl protocol.

the relevant code snippet is:

image3D, status3D = self.stream3D.wait()     
 np_array3D = cvb.as_array(image3D, copy=False) 
np_array_3D = np_array3D[:, :, 0]  # height map

The status3D is always good : 0

Thank you for your help,

Hi @GTG and @Mucki

I looked into it and found that there is bug in CVBpy. It is fixed in the current development branch.
If you contact our support I can provide you with a patch.

Please keep in mind that the patch is development version that might contain other/new bugs.

Here is some code that should fail with your version but run with that patch.

import os
import cvb

dev =, "drivers", ""))

#asuming that the vin driver configures 3 buffers by default., cvb.DeviceUpdateMode.UpdateDeviceImage)

with dev:

    for i in range(10):
        print("Image: " + str(i))
        image, status =
        if status == cvb.WaitStatus.Ok:
            print("Buffer: " + str(image.buffer_index))

print("test over")

Hi Andreas

I have contacted support, no reply. Can I get a link for the patch download?
Thank you.


1 Like

I am too working with buffers and I think I can’t achieve the results due to being unable to set the proper buffer count. Could you share the development version of the python library?

Hi @piotrM

the above issue has been fixed. What is your CVB and CVBpy version?
Do you have issues with the above spinet? You might have run int something different.

Oh sorry! I haven’t realized it was 2019. There are still some errors in py doc (I dont think RIngBufferImage has “unlock()”) so I thought its still under development. Or maybe I just don’t quite get how to access the RingBuffer. I have started a separate thread for the issue I am encountering. Thanks for the response!