X-Git-Url: https://wylark.com/src/infoex-autowx.git/blobdiff_plain/5583d801acf7ce96b5a846807a9cb9b3b5039738..214974fc923f008ebbb1a0a3cb302ca482aeb8f1:/infoex-autowx.py?ds=inline diff --git a/infoex-autowx.py b/infoex-autowx.py index b979287..abdf14a 100755 --- a/infoex-autowx.py +++ b/infoex-autowx.py @@ -29,6 +29,7 @@ import logging import os import sys import time +import importlib.util from ftplib import FTP from argparse import ArgumentParser @@ -41,7 +42,7 @@ import zeep import zeep.cache import zeep.transports -__version__ = '3.1.0' +__version__ = '3.1.1' LOG = logging.getLogger(__name__) LOG.setLevel(logging.NOTSET) @@ -228,8 +229,6 @@ def main(): station) elif station['provider'] == 'python': try: - import importlib.util - spec = importlib.util.spec_from_file_location('custom_wx', station['path']) mod = importlib.util.module_from_spec(spec) @@ -474,11 +473,19 @@ def get_mesowest_data(begin, end, station): try: observations = json['STATION'][0]['OBSERVATIONS'] - except KeyError: - LOG.error("Unexpected JSON in MesoWest response") + except KeyError as exc: + LOG.error("Unexpected JSON in MesoWest response: '%s'", exc) sys.exit(1) - except ValueError: - LOG.error("Bad JSON in MesoWest response") + except IndexError as exc: + LOG.error("Unexpected JSON in MesoWest response: '%s'", exc) + try: + LOG.error("Detailed MesoWest response: '%s'", + json['SUMMARY']['RESPONSE_MESSAGE']) + except KeyError: + pass + sys.exit(1) + except ValueError as exc: + LOG.error("Bad JSON in MesoWest response: '%s'", exc) sys.exit(1) pos = len(observations['date_time']) - 1