mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-27 22:11:11 +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
|
# Default empty toml
|
||||||
toml = {'config': {}, 'options': options}
|
# toml = {'config': {}, 'options': options}
|
||||||
|
toml = {}
|
||||||
|
|
||||||
# Load config file if it was provided
|
# Load config file if it was provided
|
||||||
toml_file = args['f']
|
toml_file = args['f']
|
||||||
|
@ -354,7 +355,7 @@ def main(argv):
|
||||||
import tomli
|
import tomli
|
||||||
try:
|
try:
|
||||||
with open(toml_file, 'rb') as config_file:
|
with open(toml_file, 'rb') as config_file:
|
||||||
toml = tomli.read(config_file)
|
toml = tomli.load(config_file)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print('config file not found')
|
print('config file not found')
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
@ -362,6 +363,8 @@ def main(argv):
|
||||||
print('Malformed config file')
|
print('Malformed config file')
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
|
print(toml)
|
||||||
|
|
||||||
# Override config file parameter values with command-line values if provided
|
# Override config file parameter values with command-line values if provided
|
||||||
if args['t'] is not None:
|
if args['t'] is not None:
|
||||||
toml['config']['twitter_account'] = args['t']
|
toml['config']['twitter_account'] = args['t']
|
||||||
|
|
Loading…
Reference in New Issue
Block a user