diff options
-rwxr-xr-x | scripts/status_script.py | 9 | ||||
-rw-r--r-- | scripts/sublab-doorstatus.last | 2 |
2 files changed, 6 insertions, 5 deletions
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 |