I'm using this with Python 3.9. Seems to me to be a compatibility error with the sorted method. bencode.py line 136, in encode for key, val in sorted(obj.items()): TypeError: '<' not supported between instances of 'bytes' and 'str'