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 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'scripts/status_script.py') 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: -- cgit v1.2.1