From ee2c0af90ed27febc2ce3d73e01f0249beac26b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Fri, 11 Mar 2022 11:42:22 +0100 Subject: [PATCH] added try check --- main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index cac07f4..83a5db1 100644 --- a/main.py +++ b/main.py @@ -93,8 +93,11 @@ if __name__ == '__main__': GPIO.setup(19, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.add_event_detect(13, GPIO.RISING, callback=power_toggle, bouncetime=300) GPIO.add_event_detect(19, GPIO.RISING, callback=change_idle_mode, bouncetime=300) - with open(current_path+'/settings.txt', 'r') as f: - idle_mode = int(f.readlines()) + try: + with open(current_path+'/settings.txt', 'r') as f: + idle_mode = int(f.readlines()) + except: + pass try: while True: