Sort error on dict_keys with python 3
Bug #1217513 reported by
Matt Jones
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Raise |
Fix Released
|
Critical
|
Unassigned |
Bug Description
Running an example with python 3 gives an error:
python3 raise
Traceback (most recent call last):
File "raise_actual", line 1116, in <module>
keys.sort()
AttributeError: 'dict_keys' object has no attribute 'sort'
Changed in raise: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
This is because in Python 3 getting the keys() of a Dict returns a dict_keys object instead of a list. Change this:
targets.keys()
to this:
list(targets. keys())