From ce43535741e189a1bfc37d2f5b51b17d0b621945 Mon Sep 17 00:00:00 2001 From: Frisk Date: Sat, 23 Jun 2018 16:14:37 +0200 Subject: [PATCH] Fixed critial error on startup --- rcgcdw.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rcgcdw.py b/rcgcdw.py index b16d492..ffb0987 100644 --- a/rcgcdw.py +++ b/rcgcdw.py @@ -32,7 +32,7 @@ with open("settings.json") as sfile: logging.basicConfig(level=settings["verbose_level"]) if settings["limitrefetch"] != -1 and os.path.exists("lastchange.txt") == False: with open("lastchange.txt", 'w') as sfile: - sfile.write("") + sfile.write("99999999999") logging.info("Current settings: {settings}".format(settings=settings)) if settings["lang"] != "en" or settings["lang"] == "": lang = gettext.translation('rcgcdw', localedir='locale', languages=[settings["lang"]]) @@ -531,8 +531,13 @@ class recent_changes_class(object): clock = 0 if settings["limitrefetch"] != -1: with open("lastchange.txt", "r") as record: - file_id = int(record.read().strip()) - logging.debug("File_id is {val}".format(val=file_id)) + file_content = record.read().strip() + if file_content: + file_id = int(file_content) + logging.debug("File_id is {val}".format(val=file_id)) + else: + logging.debug("File is empty") + file_id = 999999999 else: file_id = 999999999 #such value won't cause trouble, and it will make sure no refetch happens def add_cache(self, change):