micro-manager/pymmcore

abort crash in pymmcore.Configuration.getSetting on missing key

tlambert03 opened this issue · 1 comments

I'm wondering if there's any way this crash could be caught more gracefully, even a try/except won't protect this crash:

In [1]: from pymmcore import CMMCore

In [2]: cmm = CMMCore()

In [3]: state = cmm.getSystemState()

In [4]: state.getSetting('Core', 'AutoFocus')
Out[4]: <Swig Object of type 'PropertySetting *' at 0x10c359870>

In [5]: state.getSetting('Core', 'AutoFocs')  # whoops
libc++abi.dylib: terminating with uncaught exception of type
CMMError: Property AutoFocs not found in device Core.
[1]    8235 abort      ipython

note: I know that I can query this object safer programmatically, but curious whether we could also avoid a full crash in this scenario

@tlambert03 You're welcome!