From 4a30746f25327d2527fa6ff9f6c240a349612d5b Mon Sep 17 00:00:00 2001 From: jeancf Date: Thu, 17 Nov 2022 23:30:22 +0100 Subject: [PATCH] Fixed loading config --- twoot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/twoot.py b/twoot.py index 47fe99d..ce0813b 100755 --- a/twoot.py +++ b/twoot.py @@ -346,7 +346,8 @@ def main(argv): } # Default empty toml - toml = {'config': {}, 'options': options} + # toml = {'config': {}, 'options': options} + toml = {} # Load config file if it was provided toml_file = args['f'] @@ -354,7 +355,7 @@ def main(argv): import tomli try: with open(toml_file, 'rb') as config_file: - toml = tomli.read(config_file) + toml = tomli.load(config_file) except FileNotFoundError: print('config file not found') exit(-1) @@ -362,6 +363,8 @@ def main(argv): print('Malformed config file') exit(-1) + print(toml) + # Override config file parameter values with command-line values if provided if args['t'] is not None: toml['config']['twitter_account'] = args['t']