flush stdout

This commit is contained in:
2024-05-26 03:15:28 -05:00
parent 7ab0c83638
commit 4135f4960e

View File

@@ -29,6 +29,7 @@ nl = '\n'
# Config error message
def config_error(msg):
print(f'Error parsing config file: {msg}')
sys.stdout.flush()
sys.exit(1)
# Read config file
@@ -44,6 +45,7 @@ def get_config(filename):
except configparser.Error as e:
print(f'Error reading config file {e}')
sys.stdout.flush()
sys.exit(1)
# Parse config file
@@ -171,11 +173,13 @@ def send_alert(config, title, text, url, timestamp, keyword):
server.sendmail(smtp_from, smtp_to, text)
except Exception as e:
print(f'SMTP Send Error: {e}')
sys.stdout.flush()
if __name__ == '__main__':
config = get_config(args.config)
print(f'Current config file: {config}')
sys.stdout.flush()
check_reddit(config)