From a69f744023cf41bd40d08e12e6f80898bd826f03 Mon Sep 17 00:00:00 2001 From: Hal Simpson <hasimpson@usgs.gov> Date: Thu, 12 Nov 2015 14:44:39 -0700 Subject: [PATCH] Changed exception handling messages to go to stderr, removed check prints --- geomagio/imfv283/IMFV283Parser.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/geomagio/imfv283/IMFV283Parser.py b/geomagio/imfv283/IMFV283Parser.py index 467b75d01..671e55232 100644 --- a/geomagio/imfv283/IMFV283Parser.py +++ b/geomagio/imfv283/IMFV283Parser.py @@ -77,7 +77,6 @@ class IMFV283Parser(object): try: msg_header = self._parse_msg_header(line) - print msg_header data_len = msg_header['data_len'] # check message size indicates data exists @@ -91,14 +90,11 @@ class IMFV283Parser(object): data_len) goes_header = self._parse_goes_header(goes_data) - print goes_header data = self._get_data(goes_header, goes_data) self._post_process(data, msg_header, goes_header) - except KeyError as e: - print "Incorrect data line" - print e - print line - + except (KeyError, IndexError, ValueError) as e: + sys.stderr.write("Incorrect data line ") + sys.stderr.write(line) def _get_data(self, header, data): """get data from data packet -- GitLab