meraki-analytics / cassiopeia

An all-inclusive Python framework for the Riot Games League of Legends API. Cass focuses on making the data easy and fun to work with, while providing all the tools necessary to create a website or do data analysis.
MIT License
553 stars 134 forks source link

AttributeError on certain properties from Participant object #266

Closed Hargre closed 5 years ago

Hargre commented 5 years ago

Bug Report

I was looking through some of the examples in the documentation, and when trying to run the match one I got the following error around this line: AttributeError: 'Participant' object has no attribute '_lazy__champion'

I tried running similar code with different matches and summoners, and got the same result. The whole traceback is as follows:

Traceback (most recent call last):
  File "/home/felipe/.virtualenvs/pyenv/lib/python3.6/site-packages/merakicommons/cache.py", line 15, in wrapper
    return getattr(self, s)
AttributeError: 'Participant' object has no attribute '_lazy__champion'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_cass.py", line 78, in <module>
    id=21359666, region="NA")
  File "test_cass.py", line 37, in print_newest_match
    champion_id = match.participants[summoner.name].champion.id
  File "/home/felipe/.virtualenvs/pyenv/lib/python3.6/site-packages/merakicommons/cache.py", line 17, in wrapper
    value = method(self)
  File "/home/felipe/.virtualenvs/pyenv/lib/python3.6/site-packages/cassiopeia/core/match.py", line 26, in wrapper
    return method(self, *args, **kwargs)
  File "/home/felipe/.virtualenvs/pyenv/lib/python3.6/site-packages/cassiopeia/core/match.py", line 1145, in champion
    version = _choose_staticdata_version(self.__match)
  File "/home/felipe/.virtualenvs/pyenv/lib/python3.6/site-packages/cassiopeia/core/match.py", line 59, in _choose_staticdata_version
    patch = Patch.from_date(match.creation, region=match.region)
  File "/home/felipe/.virtualenvs/pyenv/lib/python3.6/site-packages/cassiopeia/core/patch.py", line 62, in from_date
    cls.__load__()
  File "/home/felipe/.virtualenvs/pyenv/lib/python3.6/site-packages/cassiopeia/core/patch.py", line 84, in __load__
    data = configuration.settings.pipeline.get(PatchListDto, query={})
  File "/home/felipe/.virtualenvs/pyenv/lib/python3.6/site-packages/datapipelines/pipelines.py", line 459, in get
    return handler.get(query, context)
  File "/home/felipe/.virtualenvs/pyenv/lib/python3.6/site-packages/datapipelines/pipelines.py", line 185, in get
    result = self._source.get(self._source_type, deepcopy(query), context)
  File "/home/felipe/.virtualenvs/pyenv/lib/python3.6/site-packages/datapipelines/sources.py", line 69, in wrapper
    return call(self, query, context=context)
  File "/home/felipe/.virtualenvs/pyenv/lib/python3.6/site-packages/cassiopeia/datastores/merakianalyticscdn.py", line 41, in get_patch_list
    body = json.decode(body)
  File "/usr/lib64/python3.6/json/__init__.py", line 349, in loads
    s = s.decode(detect_encoding(s), 'surrogatepass')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Similar errors occur for the following properties:

To Reproduce

Run the match example, or try to access one of the following properties from a Participant object:

Environment Info

I ran into the error under a virtualenv with Python 3.6.6 and cassiopeia 3.0.21.

jjmaldonis commented 5 years ago

Hey thanks for the report. I can't reproduce this issue on the latest version. Can you try updating to the latest github version and seeing if that solves the problem?

Here is the terminal command to update from github: pip install --upgrade git+https://github.com/meraki-analytics/cassiopeia.git

Hargre commented 5 years ago

Hey, I updated but still got the error. I tried running it in another machine, though (in a VM, actually) and everything worked. Must be some issue on my end, then. If I find out what the problem is and if it's something relevant to the framework I'll send an update here. Thanks for the help!