dict instances cannot be compared in Python 3
Closed this issue · 5 comments
jceloria commented
$─► ti l 2>&1 | sed "s|${USER}|<redacted>|g"
Traceback (most recent call last):
File "/Users/<redacted>/local/Darwin/bin/ti", line 11, in <module>
sys.exit(main())
File "/Users/<redacted>/local/Darwin/lib/python3.6/site-packages/ti/__init__.py", line 451, in main
fn(**args)
File "/Users/<redacted>/local/Darwin/lib/python3.6/site-packages/ti/__init__.py", line 265, in action_log
for name, item in sorted(log.items(), key=(lambda x: x[1]), reverse=True):
TypeError: '<' not supported between instances of 'dict' and 'dict'
itsonlybarney commented
I don't have access to Git at the moment to make a pull request, but I found that this can be corrected with a simple change.
Change line 283 from:
for name, item in sorted(log.items(), key=(lambda x: x[1]), reverse=True):
to:
for name, item in sorted(log.items(), key=(lambda x: x[0]), reverse=True):
rveeblefetzer commented
I can confirm that @itsonlybarney's fix works on Python 3.6.3
rveeblefetzer commented
@itsonlybarney did you ever do a test for this? if you want to put it up, I can write the tests
itsonlybarney commented
I haven't done any specific tests for it, although I have been using it for weeks without problems.
tbekolay commented
Fixed in #16. Thanks @itsonlybarney for the fix and @jceloria for the report!