From: Alexander Vasarab Date: Mon, 30 Nov 2020 01:31:46 +0000 (-0800) Subject: Add some comments and exceptions X-Git-Tag: v3.0.0^2~1^2 X-Git-Url: https://wylark.com/src/infoex-autowx.git/commitdiff_plain/e5e99725940efb3889e6aad4ff5661503d2f4af4?ds=sidebyside Add some comments and exceptions --- 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)