mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-24 04:21:13 +00:00
Fixed loading config
This commit is contained in:
parent
d336711514
commit
4a30746f25
7
twoot.py
7
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']
|
||||
|
|
Loading…
Reference in New Issue
Block a user