diff options
Diffstat (limited to 'main.py')
-rw-r--r-- | main.py | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -13,14 +13,14 @@ def get_location(args): config = ConfigParser() config_location = xdg_config_home().joinpath("auto-dark-mode", "config") - with open(config_location) as stream: - config.read_string("[auto-dark-mode]\n" + stream.read()) - config.read(config_location) - try: + with open(config_location) as stream: + config.read_string("[auto-dark-mode]\n" + stream.read()) + config.read(config_location) + latitude = config.getfloat("auto-dark-mode", "latitude") longitude = config.getfloat("auto-dark-mode", "longitude") - except NoOptionError: + except (FileNotFoundError, NoOptionError): sys.exit( f"Please supply latitude and longitude with the --latitude and --longitude flags, or set them in {config_location}" ) |