From: Philippe Proulx Date: Sat, 16 Sep 2017 05:05:20 +0000 (-0400) Subject: bt2: trace collection notif. iter.: try to check the query result X-Git-Tag: v2.0.0-pre4~30 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=f4811b4fbd18dc912ed4cb2f8a210c3c46203dfe bt2: trace collection notif. iter.: try to check the query result This could fail if the structure is not as expected: just raise bt2.Error in this case. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/bindings/python/bt2/bt2/trace_collection_notification_iterator.py b/bindings/python/bt2/bt2/trace_collection_notification_iterator.py index 179ac357..d7f1ae5e 100644 --- a/bindings/python/bt2/bt2/trace_collection_notification_iterator.py +++ b/bindings/python/bt2/bt2/trace_collection_notification_iterator.py @@ -128,12 +128,15 @@ class TraceCollectionNotificationIterator(bt2.notification_iterator._Notificatio end = None # find the trace info for this port's trace by name's prefix - for trace_info in trace_info_res: - if port.name.startswith(str(trace_info['path'])): - range_ns = trace_info['intersection-range-ns'] - begin = range_ns['begin'] - end = range_ns['end'] - break + try: + for trace_info in trace_info_res: + if port.name.startswith(str(trace_info['path'])): + range_ns = trace_info['intersection-range-ns'] + begin = range_ns['begin'] + end = range_ns['end'] + break + except: + pass if begin is None or end is None: raise bt2.Error('cannot find stream intersection range for port "{}"'.format(port.name))