From 428ff6ecdbb79c499cf73c1445bf7f2eb94b6196 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Fri, 1 Dec 2023 16:03:05 +0100 Subject: [PATCH] Add a message when there is a bad_function_call --- python/podio/frame_iterator.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/podio/frame_iterator.py b/python/podio/frame_iterator.py index b3d9925ad..7c0e52230 100644 --- a/python/podio/frame_iterator.py +++ b/python/podio/frame_iterator.py @@ -2,7 +2,7 @@ """Module defining the Frame iterator used by the Reader interface""" # pylint: disable-next=import-error # gbl is a dynamic module from cppyy -from cppyy.gbl import std +from cppyy.gbl import std, bad_function_call from podio.frame import Frame @@ -51,7 +51,14 @@ def __getitem__(self, entry): # If we are below 0 now, we do not have enough entries to serve the request raise IndexError - frame_data = self._reader.readEntry(self._category, entry) + try: + frame_data = self._reader.readEntry(self._category, entry) + except bad_function_call: + print('Error: Unable to read an entry of the input file. This can happen when the ' + 'ROOT model dictionaries are not in LD_LIBRARY_PATH. Make sure that LD_LIBRARY_PATH ' + 'points to the library folder of the installation of podio and also to the library ' + 'folder with your data model\n') + raise if frame_data: return Frame(std.move(frame_data))