IC-Imaging-Control-Samples icon indicating copy to clipboard operation
IC-Imaging-Control-Samples copied to clipboard

ctypes.ArgumentError: Expected LP_HGRABBER instance instead of LP_HGRABBER

Open vandoitruong opened this issue 2 years ago • 3 comments

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: error

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!

vandoitruong avatar Apr 05 '22 00:04 vandoitruong

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

TIS-Stefan avatar Apr 05 '22 12:04 TIS-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.

vandoitruong avatar Apr 13 '22 05:04 vandoitruong

Hello

At end of your program you should call ic.IC_ReleaseGrabber(hGrabber)

Stefan

TIS-Stefan avatar Apr 13 '22 07:04 TIS-Stefan