From a38efd3626359feccd2478e67d7368adc6dfcc1c Mon Sep 17 00:00:00 2001 From: Neythen Treloar Date: Thu, 7 Apr 2022 19:10:41 +0100 Subject: [PATCH] server crash fix --- server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index 8acf140..1c5026a 100755 --- a/server.py +++ b/server.py @@ -60,8 +60,13 @@ ALLOWED_EXTENSIONS = {'csv', 'png'} ticker = pexpect.spawn("sudo -E python3 stockTicker.py") time.sleep(2) # give the ticker time to initialise -f = open('csv/system_info.json') -system_info = json.load(f) +f = open('csv/system_info.json', 'w') + +try: + system_info = json.load(f) +except: + system_info = {"update_available": False, "first_boot": False} + json.dump(system_info, f) f.close() ticker.sendline('*') # run startup gif by default