agoragames / leaderboard-python

Leaderboards backed by Redis in Python
https://github.com/agoragames/leaderboard-python
MIT License
156 stars 44 forks source link

Breaking changes in Redis-Py 3+ #61

Open airman00 opened 5 years ago

airman00 commented 5 years ago

If you install the latest version of Redis Python Client (3.1.0 at this time) you will receive this error when trying to run the sample code and use the rank_member function for the first time: AttributeError: 'str' object has no attribute 'items'

This is because of breaking changes that occurred between Redis Client v2.x to v3.x https://github.com/andymccurdy/redis-py#upgrading-from-redis-py-2x-to-30

This specific issue can be solved as follows, but I'm not sure if other parts may have broken: https://stackoverflow.com/questions/53553009/not-able-to-insert-data-using-zaddsorted-set-in-redis-using-python

As a super quick fix, you can use redis python client v2.10.6

To install that version of redis run the following: pip install redis==2.10.6

YuriHeupa commented 5 years ago

I sent a PR #62 that adds support for redis-py 3+, it's pending review, but for those who need to use this lib with redis-py 3+ immediately, here's a workaround:

$ pip install git+git://github.com/YuriHeupa/leaderboard-python.git@ccf3b284db35512950909aed8d1d3436557d3efb 

This command installs the changes from my fork I used to create the PR, which supports the newest version of redis-py.