From 747433b523950be79ef79f6db77b6f93351b8344 Mon Sep 17 00:00:00 2001 From: Tamas Gal <tgal@km3net.de> Date: Sun, 2 Feb 2020 00:03:24 +0100 Subject: [PATCH] Fix empty db issue --- scripts/ztplot.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/ztplot.py b/scripts/ztplot.py index cf3b27b..ca64b19 100755 --- a/scripts/ztplot.py +++ b/scripts/ztplot.py @@ -88,11 +88,14 @@ class ZTPlot(kp.Module): """Update the lower limits for the Top-10 candidate selection""" n_candidates = 10 for category in ["overlays", "n_hits", "n_triggered_hits"]: - lower_limit = self.services["query"]( - "SELECT {cat} FROM {tab} ORDER BY {cat} DESC LIMIT {limit}". - format(cat=category, - tab=self.event_selection_table, - limit=n_candidates))[-1][0] + try: + lower_limit = self.services["query"]( + "SELECT {cat} FROM {tab} ORDER BY {cat} DESC LIMIT {limit}". + format(cat=category, + tab=self.event_selection_table, + limit=n_candidates))[-1][0] + except IndexError: + lower_limit = 0 self.lower_limits[category] = lower_limit self.cprint("Current limits for the Top-10: {}".format( -- GitLab