From e5e99725940efb3889e6aad4ff5661503d2f4af4 Mon Sep 17 00:00:00 2001 From: Alexander Vasarab Date: Sun, 29 Nov 2020 17:31:46 -0800 Subject: [PATCH] Add some comments and exceptions --- examples/custom-wx.example.py | 4 ++++ infoex-autowx.py | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/custom-wx.example.py b/examples/custom-wx.example.py index 565e71f..0b2cc42 100644 --- a/examples/custom-wx.example.py +++ b/examples/custom-wx.example.py @@ -27,5 +27,9 @@ def get_custom_data(): # Whatever your program needs to do to get its data can be done # either here in this function directly, or elsewhere with # modification to the global variable `wx_data`. + # + # NOTE: The LOG class from infoex-autowx is available, so you may + # issue e.g. LOG.info('some helpful information') in your + # program. return wx_data diff --git a/infoex-autowx.py b/infoex-autowx.py index f285c42..c191e5c 100755 --- a/infoex-autowx.py +++ b/infoex-autowx.py @@ -228,9 +228,9 @@ def main(): if infoex['wx_data'] is None: infoex['wx_data'] = [] - except Exception: + except Exception as exc: LOG.error("Python program for custom Wx data failed in " - "execution") + "execution: " + str(exc)) sys.exit(1) LOG.info("Successfully executed external Python program") @@ -241,6 +241,10 @@ def main(): LOG.error("Specified Python program for custom Wx data " "was not found") sys.exit(1) + except Exception as exc: + LOG.error("A problem was encountered when attempting to " + "load your custom Wx program: " + str(exc)) + sys.exit(1) LOG.info("Time taken to get all data : %.3f sec", time.time() - time_all_elements) -- 2.30.2