IC-Imaging-Control-Samples
IC-Imaging-Control-Samples copied to clipboard
ctypes.ArgumentError: Expected LP_HGRABBER instance instead of LP_HGRABBER
Dear sir,
First, I ran an example 41 without error, however if I close that application and run the program gain, I got a " ctypes.ArgumentError " as below figure:
Current solution: restart the kernel every time when running the program. However, it's quite inconvenient, could you please give me some suggestions to fix this problem? Thank you so much!
Hello
I guess, the frameReadyCallback is called, but the device, resp. the pointer in HGrabber is no longer valid. I would add a time.sleep(0.5) in
def Close():
for camera in cameras:
camera.stopCamera()
time.sleep(0.5)
app.quit()
But that is guessing. I do not now, what the error means. Which camera models do you use? Which computer model do you use?
Stefan
Thank you for your reply! I added your suggestion however it also occurred that problem.
I tried to add this line into the frameReadyCallback function:
print('thread index:', threading.get_ident(), "\n")
After exiting a program, Camera threads still exist and print out the thread index.
I think the IC_StopLive function could be a reason because it can not release camera.
Hello
At end of your program you should call
ic.IC_ReleaseGrabber(hGrabber)
Stefan