From 67ca542b9c6d0d506997ad5683e61c4146b3a05a Mon Sep 17 00:00:00 2001 From: tachylatus Date: Wed, 7 Jan 2015 12:42:48 +0100 Subject: [PATCH] Fix for python3 TypeError for 'dict_keys' TypeError: 'dict_keys' object does not support indexing Explanation: In python2x, edid_map.keys() returned a list. With python3.x, it returns a dict_keys object, which behaves more like a set instead of list. Inspired from: http://stackoverflow.com/questions/17322668/xi-xj-xj-xi-typeerror-dict-keys-object-does-not-support-indexing I tested this change with python2, and it seems to work. --- autorandr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autorandr.py b/autorandr.py index e9d1c25..a5206c4 100755 --- a/autorandr.py +++ b/autorandr.py @@ -218,7 +218,7 @@ class XrandrOutput(object): fuzzy_output = re.sub("(card[0-9]+|-)", "", options["output"]) if fuzzy_output not in fuzzy_edid_map: raise RuntimeError("Failed to find a corresponding output in config/setup for output `%s'" % options["output"]) - edid = edid_map[edid_map.keys()[fuzzy_edid_map.index(fuzzy_output)]] + edid = edid_map[list(edid_map.keys())[fuzzy_edid_map.index(fuzzy_output)]] output = options["output"] del options["output"] -- 2.39.5