Blizzard / heroprotocol

Python library to decode Heroes of the Storm replays
MIT License
398 stars 69 forks source link

Python 3 support #59

Closed petronny closed 4 years ago

Zylvian commented 6 years ago

Hey!

I churned the entire repo through Python's 2to3, it's uploaded here atm: https://github.com/Zylvian/SendHots/tree/master/heroprotocol3

albuszheng commented 6 years ago

In Python 3 when iterating through byte objects, there is no need to use ord() function to change it from a str object to int like in Python 2. Byte document states:

While bytes literals and representations are based on ASCII text, bytes objects actually behave like immutable sequences of integers...

Lines like this self._next = ord(self._data[self._used]) will likely produce a type error:

TypeError: ord() expected string of length 1, but int found