genicam / harvesters

Image Acquisition Library for GenICam-based Machine Vision System
Apache License 2.0
500 stars 86 forks source link

Unable to KeyboardInterrupt when ImageAcquirer exists #463

Open zamzz opened 1 week ago

zamzz commented 1 week ago

Describe the Issue Keyboard Interrupt / Ctrl+C isn't being caught/acknowledged when an ImageAcquirer is in existence. Interesting that quit() instead of Ctrl+C works for me.

Sample Code I can show a piece of code that demonstrates the reported phenomenon:

If yes, please provide a sample code:

Stops on KeyboardInterrupt once "waiting!" starts printing:

import time
from harvesters.core import Harvester

if __name__ == "__main__":
    h = Harvester()
    h.add_file("")  # insert producer path here
    h.update()

#    with h.create() as ia:
#        pass

    while True:
        print("waiting!")
        time.sleep(1)

Doesn't stop on KeyboardInterrupt once "waiting!" starts printing:

import time
from harvesters.core import Harvester

if __name__ == "__main__":
    h = Harvester()
    h.add_file("")  # insert producer path here
    h.update()

    with h.create() as ia:
        pass

    while True:
        print("waiting!")
        time.sleep(1)

Expected Behavior

Configuration

Reproducibility

This phenomenon can be stably reproduced:

If applicable, please provide your observation about the reproducibility. I'm unsure if this happens with other cameras (or producers to be honest).

Actions You Have Taken

KABILAN235 commented 1 day ago

I've got the same problem too and haven't found a solution yet