From 118a2aae66b608eb3eef318fe4e113303de121fc Mon Sep 17 00:00:00 2001 From: Duncan Macleod Date: Thu, 8 Mar 2018 04:35:23 -0800 Subject: [PATCH] data.find_frames: fixed IndexError for no frames --- omicron/data.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/omicron/data.py b/omicron/data.py index 655f875..efc1291 100644 --- a/omicron/data.py +++ b/omicron/data.py @@ -208,11 +208,14 @@ def find_frames(obs, frametype, start, end, connection=None, **kwargs): # use latest frame to find more recent frames that aren't in # datafind yet, this is quite hacky, and isn't guaranteed to # work at any point, but it shouldn't break anything - latest = cache[-1] + try: + latest = cache[-1] + except IndexError: # no frames + return cache try: ngps = len(re_gwf_gps_epoch.search( os.path.dirname(latest.path)).groupdict()['gpsepoch']) - except AttributeError: + except AttributeError: # no match pass else: while True: