From 6a6c8f88a6964ef68240cf91cd864128ceef3243 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Fri, 14 Dec 2018 10:52:03 +0100 Subject: [PATCH] Write lastrun file even if modifications were made --- montrouge.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/montrouge.py b/montrouge.py index 6360c95..ddd5068 100644 --- a/montrouge.py +++ b/montrouge.py @@ -46,16 +46,15 @@ for (k, url) in URLS.items(): dump = json.dumps(data, sort_keys=True, indent=4, separators=(',', ': ')) -try: - with open('lastrun.json', 'r') as fh: - lastrun = fh.read() - # If something changed, print the fetched data and exit 1 to ensure chronic - # sends an email. - if lastrun != dump: - print(dump) - sys.exit(1) -except IOError: - pass + +with open('lastrun.json', 'r') as fh: + lastrun = fh.read() with open('lastrun.json', 'w') as fh: fh.write(dump) + +# If something changed, print the fetched data and exit 1 to ensure chronic +# sends an email. +if lastrun != dump: + print(dump) + sys.exit(1)