cassiopeia
cassiopeia copied to clipboard
ValueError: 'CHERRY' is not a valid Queue when Summoner has played Arena games
When using the league_entries.fives feature to retrieve solo queue entries for a summoner participating in the Arena game mode. A ValueError is raised because the Queue enum does not contain the Queue ID for Arena games, specifically "CHERRY."
The error occurs when the summoner has played Arena, and the Queue enum attempts to handle it without the proper Queue ID. However, this error will not occur to any summoner who has not played Arena.
ValueError: 'CHERRY' is not a valid Queue
Resolved by adding the "CHERRY" to the 'Data.Queue' enum.
Code to Replicate:
import cassiopeia as cass
from cassiopeia.data import Queue
from cassiopeia.core import Account, Summoner
def print_leagues(name: str, tagline: str, region: str):
account = Account(name=name, tagline=tagline, region=region)
print("Name:", account.name)
print("ID:", account.summoner.id)
entries = account.summoner.league_entries
if entries.fives is not None:
print(f"\nQueue: {entries.fives.queue}")
print(f"Tier: {entries.fives.tier}")
print(f"Division: {entries.fives.division}")
print(f"Wins: {entries.fives.wins}")
print(f"Losses: {entries.fives.losses}\n")
else:
print("The summoner has not played Ranked Fives.")
if __name__ == "__main__":
# Account without Arena Games
print_leagues("smurftocarryjm", "4483", "PH")
# Account with Arena Games
print_leagues("outofmana", "AHRI", "PH")
# Account with Arena and no Rank Games
# print_leagues("KaiserV", "GOW", "PH")
# Account without Arena games
# print_leagues("Pobelter", "NA1", "NA")
Full traceback when attempting to retrieve league_entries.fives for a summoner who has played Arena games:
Name: outofmana
Making call: https://asia.api.riotgames.com/riot/account/v1/accounts/by-riot-id/outofmana/AHRI
Making call: https://ph2.api.riotgames.com/lol/summoner/v4/summoners/by-puuid/xxDFu30gd9_kx8texxXhZouqOEIRGwuKW3FirpsTZYE8zliHztG2yV0MCRT-pWy4z6JD8qNTzYd48A
ID: JtlNHePz0_iWMqjp84SszBjTSiAdfYDlQkrA9iicUOYKLwpPdIkX4FuRiQ
Making call: https://ph2.api.riotgames.com/lol/league/v4/entries/by-summoner/JtlNHePz0_iWMqjp84SszBjTSiAdfYDlQkrA9iicUOYKLwpPdIkX4FuRiQ
Traceback (most recent call last):
File "E:\Python\Lib\site-packages\merakicommons\cache.py", line 15, in wrapper
return getattr(self, s)
^^^^^^^^^^^^^^^^
AttributeError: 'LeagueSummonerEntries' object has no attribute '_lazy__fives'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Python\Lib\site-packages\merakicommons\cache.py", line 15, in wrapper
return getattr(self, s)
^^^^^^^^^^^^^^^^
AttributeError: 'LeagueEntry' object has no attribute '_lazy__queue'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "e:\Github\LOL_DATAGATHERING_THESIS_2\RiotAPI\testing.py", line 31, in <module>
print_leagues("outofmana", "AHRI", "PH")
File "e:\Github\LOL_DATAGATHERING_THESIS_2\RiotAPI\testing.py", line 16, in print_leagues
if entries.fives is not None:
^^^^^^^^^^^^^
File "E:\Python\Lib\site-packages\merakicommons\cache.py", line 17, in wrapper
value = method(self)
^^^^^^^^^^^^
File "E:\Python\Lib\site-packages\cassiopeia\core\league.py", line 392, in fives
if entry.queue is Queue.ranked_solo_fives:
^^^^^^^^^^^
File "E:\Python\Lib\site-packages\merakicommons\cache.py", line 17, in wrapper
value = method(self)
^^^^^^^^^^^^
File "E:\Python\Lib\site-packages\cassiopeia\core\league.py", line 229, in queue
return Queue(self._data[LeagueEntryData].queue)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Python\Lib\enum.py", line 712, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Python\Lib\enum.py", line 1128, in __new__
raise ve_exc
ValueError: 'CHERRY' is not a valid Queue
Hi, @CarlVictorV I would like to work on this, kindly assign :)
Wasn't the issue fixed by #460?
Wasn't the issue fixed by #460?
TY for reminding me. I thought I changed the status before