meraki-analytics/role-identification

get_team_roles returns champs that are not in match

Closed this issue · 4 comments

champion_roles = get_data()
match = cass.get_match(3291043659, region="KR")
roles_winning_team = get_team_roles(match.blue_team, champion_roles)
print(roles_winning_team[Role.middle].id)

This prints 34 which is Anivia.

There is no Anivia in this game... https://matchhistory.na.leagueoflegends.com/en/#match-details/KR/3291043659?tab=overview

@deekay42 Fixed this. You'll have to pull the latest versions of Cassiopeia as well as our champion.gg plugin from github in order for it to work.

I uninstalled the old packages and reinstalled with:

pip install git+https://github.com/meraki-analytics/cassiopeia#egg=cassiopeia
pip install git+https://github.com/meraki-analytics/cassiopeia-plugins#subdirectory=cassiopeia-championgg&egg=cassiopeia_championgg
pip install git+https://github.com/meraki-analytics/role-identification#egg=roleidentification

Now I'm getting this error:

Connected to pydev debugger (build 173.4301.16)
Making call: https://ddragon.leagueoflegends.com/realms/na.json
Making call: https://ddragon.leagueoflegends.com/cdn/8.16.1/data/en_US/championFull.json
Making call: https://cdn.merakianalytics.com/riot/lol/resources/patches.json
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/merakicommons/cache.py", line 15, in wrapper
    return getattr(self, s)
AttributeError: 'Champion' object has no attribute '_lazy__championgg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1668, in <module>
    main()
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1662, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1072, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/dk/Documents/code/lol/getRoles/getRole.py", line 68, in <module>
    champion_roles = get_data()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/roleidentification/pull_data.py", line 16, in get_data
    champion.championgg.load()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/merakicommons/cache.py", line 17, in wrapper
    value = method(self)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cassiopeia_championgg/__init__.py", line 21, in championgg
    patch = Patch.from_str(patch_name, region=self.region)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cassiopeia/core/patch.py", line 48, in from_str
    cls.__load__()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cassiopeia/core/patch.py", line 84, in __load__
    data = configuration.settings.pipeline.get(PatchListDto, query={})
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/datapipelines/pipelines.py", line 459, in get
    return handler.get(query, context)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/datapipelines/pipelines.py", line 185, in get
    result = self._source.get(self._source_type, deepcopy(query), context)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/datapipelines/sources.py", line 69, in wrapper
    return call(self, query, context=context)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cassiopeia/datastores/merakianalyticscdn.py", line 40, in get_patch_list
    body = json.decode(body)
AttributeError: module 'json' has no attribute 'decode'

From your terminal run: conda install ujson (pip might work too but use conda if you installed python via anaconda). The normal json package doesn't have a .decode method, but ujson does so installing ujson will fix the error. I'll fix this issue sometime soon, thanks for reporting it.

That worked. Thanks.
Awesome library btw, super useful!