genicam / harvesters

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

Ports without URLs should not raise an exception in `update()` #435

Open eudoxos opened 8 months ago

eudoxos commented 8 months ago

The following lines retrieve url list from a port, but fail when there is no URL. I think this is legitimate (I double-checked with GCGetNumPortURLs and should be handled gracefully. Think of a NIC with no camera attached, or USB transport layer momentarily without camera — not a reason to crash, just the state of things at that moment:

https://github.com/genicam/harvesters/blob/b97fec3c0972007b1a15a2b6a8b7e5582d6d72d7/src/harvesters/core.py#L374-L382

I suggest to say

except (GetnTL_GenericException, LogicalException):
   return create_new_file, None

which is handled gracefully by the caller.