]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blobdiff - autorandr.py
Python: Python 3 compatibility restored
[deb_pkgs/autorandr.git] / autorandr.py
index e7ab98866c93c47aa7efa2bfd904ba9a95f29abe..1225491d9fc492923159a817d7b026ee142a11bc 100755 (executable)
@@ -322,8 +322,8 @@ def load_profiles(profile_path):
             else:
                 buffer.append(line)
 
-        for output_name, output in config.items():
-            if "off" in output.options:
+        for output_name in list(config.keys()):
+            if "off" in config[output_name].options:
                 del config[output_name]
 
         profiles[profile] = config
@@ -526,7 +526,11 @@ def main(argv):
         if load_profile in ( x[0] for x in virtual_profiles ):
             profile = generate_virtual_profile(config, modes, load_profile)
         else:
-            profile = profiles[load_profile]
+            try:
+                profile = profiles[load_profile]
+            except KeyError:
+                print("Failed to load profile '%s':\nProfile not found" % load_profile, file=sys.stderr)
+                sys.exit(1)
         add_unused_outputs(config, profile)
         if profile == config and not "-f" in options and not "--force" in options:
             print("Config already loaded")