From 8e9a2b6e762f2e7366e0a0fa21f0852461de082f Mon Sep 17 00:00:00 2001 From: ThioJoe <12518330+ThioJoe@users.noreply.github.com> Date: Mon, 27 Dec 2021 13:21:33 -0500 Subject: [PATCH] Update Script - Fix config out-of-date warning Fixed program displaying warning about config being out of date, when there is no config file at all. Add config to gitignore --- .gitignore | 3 +++ YouTubeSpammerPurge.py | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 6029df38..6a7e403c 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,6 @@ token.pickle # Ignore log files Spam_*.txt Spam_*.rtf + +# Ignore user-generated config file +SpamPurgeConfig.ini diff --git a/YouTubeSpammerPurge.py b/YouTubeSpammerPurge.py index 6084fb4a..444ad0c0 100644 --- a/YouTubeSpammerPurge.py +++ b/YouTubeSpammerPurge.py @@ -2029,14 +2029,17 @@ def main(): # Check for config file, load into dictionary 'config' config = load_config_file() - try: - configFileVersion = int(config['config_version']) - if configFileVersion < configVersion: + if config: + try: + configFileVersion = int(config['config_version']) + if configFileVersion < configVersion: + configOutOfDate = True + else: + configOutOfDate = False + except: configOutOfDate = True - else: - configOutOfDate = False - except: - configOutOfDate = True + else: + configOutOfDate = False os.system(clear_command) if config != None: @@ -2115,7 +2118,7 @@ def main(): if updateAvailable == True: print(f"{F.LIGHTGREEN_EX}Notice: A new version is available! Choose 'Check For Updates' option for details.{S.R}\n") - if configOutOfDate == True: + if config and configOutOfDate == True: print(f"{F.LIGHTRED_EX}Notice: Your config file is out of date! Choose 'Create your own config file' to generate a new one.{S.R}\n") # Make sure input is valid, if not ask again