From: tachylatus Date: Wed, 7 Jan 2015 11:42:48 +0000 (+0100) Subject: Fix for python3 TypeError for 'dict_keys' X-Git-Tag: 1.0~115^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=67ca542b9c6d0d506997ad5683e61c4146b3a05a;p=deb_pkgs%2Fautorandr.git 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. --- 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"]