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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug in LeagueEntries function?

deekay42 opened this issue · comments

t = LeagueEntries(region="EUW", queue=Queue.ranked_solo_fives, tier=Tier.diamond, division=Division.one)

Evaluating inside Pycharm debugger gives me

Connected to pydev debugger (build 192.6817.19)
Making call: https://euw1.api.riotgames.com/lol/league/v4/entries/RANKED_SOLO_5x5/DIAMOND/I?page=1
Error evaluating: thread_id: pid_1409_id_4380619552
frame_id: 140369809090088
scope: FRAME
attrs: t
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_vars.py", line 285, in resolve_compound_variable_fields
return _typeName, resolver.get_dictionary(VariableWithOffset(var, offset) if offset else var)
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_resolver.py", line 285, in get_dictionary
l = len(var)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/merakicommons/container.py", line 363, in len
self._generate_more()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/merakicommons/container.py", line 380, in _generate_more
for _ in self:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/merakicommons/container.py", line 355, in iter
yield next(self)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/merakicommons/container.py", line 368, in next
value = next(self._generator)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cassiopeia/datastores/ghost.py", line 350, in generate_entries
entry = LeagueEntry.from_data(data=entrydata, loaded_groups={LeagueEntryData})
TypeError: from_data() got an unexpected keyword argument 'loaded_groups'

This is a known issue and unfortunately there's nothing we can do about it. The way the debugger works, it inspects objects and therefore loads them. This causes a chain reaction that gives this type of error. If you don't inspect the Cass objects, it's likely that you can skip over this issue. One work around is to use the .to_dict() methods for Cass objects to inspect their data, if you really need to look at them. But hopefully there's no reason you need to inspect a Cass object.

I see. Can you please point me to a code snippet on how to iterate over league entries?

I tried this but it gives the same error:


t = cass.LeagueEntries(region="EUW", queue=cass.Queue.ranked_solo_fives, tier=cass.Tier.diamond, division=cass.Division.one)
for entry in t:
    print(entry)

Thanks, this was indeed a bug on our end. I just pushed a fix and made a new pypi release. It should propagate through their servers shortly so you can update Cass.