From 6a2dca7ccbeb7d2eb7cc901754ffdbd955864b52 Mon Sep 17 00:00:00 2001 From: Alexander Pace <alexander.pace@ligo.org> Date: Mon, 25 Feb 2019 14:49:48 -0600 Subject: [PATCH] Update gstlal_inspiral_lvalert_psd_plotter: added check for json key existence --- .../bin/gstlal_inspiral_lvalert_psd_plotter | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gstlal-inspiral/bin/gstlal_inspiral_lvalert_psd_plotter b/gstlal-inspiral/bin/gstlal_inspiral_lvalert_psd_plotter index 2b5e7b277d..7df1194fc7 100755 --- a/gstlal-inspiral/bin/gstlal_inspiral_lvalert_psd_plotter +++ b/gstlal-inspiral/bin/gstlal_inspiral_lvalert_psd_plotter @@ -126,11 +126,14 @@ if not graceids: lvalert_data = json.loads(sys.stdin.read()) logging.info("%(alert_type)s-type alert for event %(uid)s" % lvalert_data) logging.info("lvalert data: %s" % repr(lvalert_data)) - filename = os.path.split(urlparse.urlparse(lvalert_data["data"]["filename"]).path)[-1] - if filename not in (u"psd.xml.gz",): - logging.info("filename is not 'psd.xml.gz'. skipping") - sys.exit() - graceids = [str(lvalert_data["uid"])] + if "filename" in lvalert_data["data"]: + filename = os.path.split(urlparse.urlparse(lvalert_data["data"]["filename"]).path)[-1] + if filename not in (u"psd.xml.gz",): + logging.info("filename is not 'psd.xml.gz'. skipping") + sys.exit() + graceids = [str(lvalert_data["uid"])] + else: + logging.info("json key filename not in lvalert data, skipping) gracedb_client = gracedb.GraceDb(service_url = options.gracedb_service_url) -- GitLab