From 963b45f4c04c4da390aa9faa12e82691ffcb2237 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 13 Feb 2014 12:04:36 +0100 Subject: status script checks now, if statusfile exists --- scripts/status_script.py | 9 ++++++--- scripts/sublab-doorstatus.last | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 scripts/sublab-doorstatus.last diff --git a/scripts/status_script.py b/scripts/status_script.py index 0f218d9..739cfcf 100755 --- a/scripts/status_script.py +++ b/scripts/status_script.py @@ -109,9 +109,12 @@ if __name__ == '__main__': s = SublabStatus() # read file with last status - with open(STATUSFILE, 'r') as status_file: - old_status = status_file.readline().rstrip() - last_change = status_file.readline().rstrip() + try: + with open(STATUSFILE, 'r') as status_file: + old_status = status_file.readline().rstrip() + last_change = status_file.readline().rstrip() + except Exception: + save_statusfile(STATUSFILE, s.door_status()) # check if status changed, if yes, update css and tweet it if s.door_status() != old_status: diff --git a/scripts/sublab-doorstatus.last b/scripts/sublab-doorstatus.last deleted file mode 100644 index e97f71f..0000000 --- a/scripts/sublab-doorstatus.last +++ /dev/null @@ -1,2 +0,0 @@ -closed -today -- cgit v1.2.1