diff --git a/sharppy/databases/pwv.py b/sharppy/databases/pwv.py index 8da0e776..360979fc 100644 --- a/sharppy/databases/pwv.py +++ b/sharppy/databases/pwv.py @@ -4,6 +4,7 @@ from datetime import datetime import numpy as np import os +import logging ## written by Greg Blumberg - CIMMS ## and @@ -193,7 +194,8 @@ def __init__(self, data_path=os.path.dirname(__file__)): self._pwv_mn['lon'] = stns[stn_idx]['lon'] self._pwv_st['lat'] = stns[stn_idx]['lat'] self._pwv_st['lon'] = stns[stn_idx]['lon'] - except IndexError: + except IndexError as e: + logging.exception(e) pass def getStddev(self, stddev, loc, month=None): diff --git a/sharppy/viz/SPCWindow.py b/sharppy/viz/SPCWindow.py index 6a966b5c..3ae82480 100644 --- a/sharppy/viz/SPCWindow.py +++ b/sharppy/viz/SPCWindow.py @@ -322,7 +322,8 @@ def setProfileCollection(self, prof_id): try: self.pc_idx = self.prof_ids.index(prof_id) - except ValueError: + except ValueError as e: + logging.exception(e) print("Hmmm, that profile doesn't exist to be focused ...") return @@ -338,7 +339,8 @@ def rmProfileCollection(self, prof_id): logging.debug("Removing Profile Collection from SPCWindow.") try: pc_idx = self.prof_ids.index(prof_id) - except ValueError: + except ValueError as e: + logging.exception(e) print("Hmmm, that profile doesn't exist to be removed ...") return @@ -881,6 +883,7 @@ def addProfileCollection(self, prof_col, focus=True, check_integrity=True): try: self.spc_widget.addProfileCollection(prof_col, menu_name, focus=focus) except Exception as exc: + logging.exception(exc) print("OOPS:", exc) ### TODO: This may be a good place to output a copy of the offending data (useful for debugging observed data). if len(self.menu_items) == 1: @@ -894,6 +897,7 @@ def testDataIntegrity(self, prof): try: prof.checkDataIntegrity() except Exception as e: + logging.exception(e) msgBox = QMessageBox() msgBox.setText("SHARPpy has detected that the data you are attempting to load may have errors.") msgBox.setInformativeText("Do you want to still try and load the data?") diff --git a/sharppy/viz/skew.py b/sharppy/viz/skew.py index 8ecbdc3e..05b29d75 100644 --- a/sharppy/viz/skew.py +++ b/sharppy/viz/skew.py @@ -977,8 +977,9 @@ def plotData(self): self.drawTrace(profile.dwpc, dewp_color, qp, p=profile.pres, width=1) try: self.drawBarbs(profile, qp, color="#666666") - except: + except Exception as e: logging.debug("Couldn't draw wind barbs in skew.py") + logging.exception(e) bg_color_idx = 0 for idx, prof_col in enumerate(self.prof_collections): if idx != self.pc_idx and (prof_col.getCurrentDate() == cur_dt or self.all_observed): @@ -990,7 +991,8 @@ def plotData(self): self.drawTrace(profile.dwpc, color, qp, p=profile.pres) try: self.drawBarbs(profile, qp, color=color) - except: + except Exception as e: + logging.exception(e) logging.debug("Couldn't draw wind barbs in skew.py") bg_color_idx = (bg_color_idx + 1) % len(self.background_colors) @@ -1040,7 +1042,8 @@ def plotData(self): qp.setRenderHint(qp.Antialiasing, False) try: self.drawBarbs(self.prof, qp) - except: + except Exception as e: + logging.exception(e) logging.debug("Couldn't draw wind barbs in skew.py") qp.setRenderHint(qp.Antialiasing) diff --git a/utils/async.py b/utils/async.py index 1f5a297b..75f89eb7 100644 --- a/utils/async.py +++ b/utils/async.py @@ -123,6 +123,7 @@ def run(self): try: ret_val = func(*args, **kwargs) except Exception as e: + logging.exception(e) if self.debug: print(traceback.format_exc()) ret_val = e diff --git a/utils/async_threads.py b/utils/async_threads.py index 9cd2900e..509d4f96 100644 --- a/utils/async_threads.py +++ b/utils/async_threads.py @@ -5,7 +5,7 @@ import Queue except ImportError: import queue as Queue - +import logging import hashlib from datetime import datetime import traceback @@ -121,6 +121,7 @@ def run(self): try: ret_val = func(*args, **kwargs) except Exception as e: + logging.exception(e) if self.debug: print(traceback.format_exc()) ret_val = e