From: Phillip Berndt Date: Fri, 15 Dec 2017 17:30:58 +0000 (+0100) Subject: Do not error out if no configuration file exists X-Git-Tag: 1.4~2 X-Git-Url: https://git.donarmstrong.com/?p=deb_pkgs%2Fautorandr.git;a=commitdiff_plain;h=e717470ee5d373935156abf7d187c39c348eaf94 Do not error out if no configuration file exists --- diff --git a/autorandr.py b/autorandr.py index 9c272a7..6bebefc 100755 --- a/autorandr.py +++ b/autorandr.py @@ -1018,8 +1018,9 @@ def read_config(options, directory): the options dictionary""" config = configparser.ConfigParser() config.read(os.path.join(directory, "settings.ini")) - for key, value in config.items("config"): - options.setdefault("--%s" % key, value) + if config.has_section("config"): + for key, value in config.items("config"): + options.setdefault("--%s" % key, value) def main(argv): try: