genicam / harvesters

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

Regression: v1.4.1 causes an exception, v1.4.0 works #436

Open creiter64 opened 8 months ago

creiter64 commented 8 months ago

Describe the Issue v1.4.1 and above cause an exception when connection to my camera.

To Reproduce Execute the sample code

Sample Code

from harvesters.core import Harvester
from pathlib import Path

h = Harvester()

GENTL_FILE = Path.cwd().parent / "./libs/s2i_GenTL_win64/GEVTLS2I.cti"
assert GENTL_FILE.is_file()

h.add_file(str(GENTL_FILE))
h.update()

ia = h.create()

Reproducable:

Expected Behavior No crash as in v1.4.0

Exception Backtrace

src\gige\genicam_connection.py:86: in connect
    self.image_src = self._harvester.create(self.device_selector)
venv\Lib\site-packages\harvesters\core.py:3076: in create
    return self._create_acquirer(device_proxy=device_proxy, config=config)
venv\Lib\site-packages\harvesters\core.py:3106: in _create_acquirer
    ia = ImageAcquirer(device_proxy=device_proxy_, config=config,
venv\Lib\site-packages\harvesters\core.py:1661: in __init__
    manager(module.register_event(event_type))
venv\Lib\site-packages\harvesters\core.py:227: in m
    return getattr(self._source_object, attribute)(*args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <genicam.gentl.System; proxy of <Swig Object of type 'std::shared_ptr< GenTLCpp::TransportLayer > *' at 0x0000024398CF47E0> >
event_id = <EVENT_TYPE_LIST.EVENT_MODULE: 5>

    def register_event(self, event_id):
        r"""

        Returns an :class:`~gentl.EventToken` object which monitors an event, specified by :data:`event_id`, on the object.

        Args:
            event_id (EVENT_TYPE_LIST): Set an event that you want to monitor.

        :rtype: EventToken

        """
>       return _gentl.System_register_event(self, event_id)
E       _gentl.InvalidHandleException: GenTL exception: Given handle does not support the operation. (Message from the source: The specified handle is not found.) (ID: -1006)

venv\Lib\site-packages\genicam\gentl.py:2303: InvalidHandleException

Configuration

Reproducibility

This phenomenon can be stably reproduced:

If applicable, please provide your observation about the reproducibility.

Actions You Have Taken

Additional context I suspect the crash might be due to events added in v1.4.1. It might be that my camera implements them incorrectly, but I'd expect harversters to not crash if I'm not using that feature.