From f1da5974f031a9850b8f3e6921df79bb9d75721c Mon Sep 17 00:00:00 2001 From: Cereal Killer Date: Sun, 3 Apr 2016 17:58:08 +0100 Subject: [PATCH] fix loading config when passed on the command line --- shreddit.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/shreddit.py b/shreddit.py index 0476ca2..dd34a83 100755 --- a/shreddit.py +++ b/shreddit.py @@ -45,12 +45,13 @@ parser.add_argument( ) args = parser.parse_args() -config = None if args.config: - config.read(args.config) + config_file = args.config else: - with open('shreddit.yml', 'r') as fh: - config = yaml.safe_load(fh) + config_file = 'shreddit.yml' + +with open(config_file, 'r') as fh: + config = yaml.safe_load(fh) if config is None: raise Exception("No config options passed!")