From 02e9fd58b6d07d3a6a484e6c1e293354b8b638ba Mon Sep 17 00:00:00 2001 From: Phillip Berndt Date: Mon, 12 Jan 2015 10:39:28 +0100 Subject: [PATCH] Python version: Better error message for missing profiles --- autorandr.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autorandr.py b/autorandr.py index e7ab988..fd18b15 100755 --- a/autorandr.py +++ b/autorandr.py @@ -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") -- 2.39.2