Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Participant' object has no attribute '_lazy__champion' #454

Open
jasonz2526 opened this issue Jun 6, 2024 · 1 comment

Comments

@jasonz2526
Copy link

I've seen this error been requested to be fixed in the past, but it's still cropping up for me. Here's the full code:

AttributeError Traceback (most recent call last)
File ~/anaconda3/lib/python3.11/site-packages/merakicommons/cache.py:15, in lazy..wrapper(self)
14 try:
---> 15 return getattr(self, s)
16 except AttributeError:

AttributeError: 'Participant' object has no attribute '_lazy__champion'

During handling of the above exception, another exception occurred:

JSONDecodeError Traceback (most recent call last)
Cell In[85], line 2
1 # Example usage
----> 2 get_matches_with_champion("Evelynn")

Cell In[83], line 9, in get_matches_with_champion(champion_name)
7 for participant in match.participants:
8 if participant.summoner == a_summoner:
----> 9 print(f"Match ID: {match.id}, Champion: {participant.champion}, Kills: {participant.stats.kills}")

File ~/anaconda3/lib/python3.11/site-packages/merakicommons/cache.py:17, in lazy..wrapper(self)
15 return getattr(self, s)
16 except AttributeError:
---> 17 value = method(self)
18 setattr(self, s, value)
19 return value

File ~/anaconda3/lib/python3.11/site-packages/cassiopeia/core/match.py:56, in load_match_on_attributeerror..wrapper(self, *args, **kwargs)
53 @functools.wraps(method)
54 def wrapper(self, *args, **kwargs):
55 try:
---> 56 return method(self, *args, **kwargs)
57 except AttributeError: # teamId
58 # The match has only partially loaded this participant and it doesn't have all it's data, so load the full match
59 match = getattr(self, "_{}__match".format(self.class.name))

File ~/anaconda3/lib/python3.11/site-packages/cassiopeia/core/match.py:1779, in Participant.champion(self)
1775 @lazy_property
1776 @load_match_on_attributeerror
1777 def champion(self) -> "Champion":
1778 # See ParticipantStats for info
-> 1779 version = _choose_staticdata_version(self.__match)
1780 return Champion(
1781 id=self._data[ParticipantData].championId,
1782 version=version,
1783 region=self.__match.region,
1784 )

File ~/anaconda3/lib/python3.11/site-packages/cassiopeia/core/match.py:100, in _choose_staticdata_version(match)
95 return None # Rather than pick the latest version here, let the obj handle it so it knows which endpoint within the realms data to use
97 if configuration.settings.version_from_match == "version" or hasattr(
98 match._data[MatchData], "version"
99 ):
--> 100 majorminor = match.patch.major + "." + match.patch.minor
101 elif configuration.settings.version_from_match == "patch":
102 patch = Patch.from_date(match.creation, region=match.region)

File ~/anaconda3/lib/python3.11/site-packages/cassiopeia/core/match.py:2073, in Match.patch(self)
2071 if hasattr(self._data[MatchData], "version"):
2072 version = ".".join(self.version.split(".")[:2])
-> 2073 patch = Patch.from_str(version, region=self.region)
2074 else:
2075 date = self.creation

File ~/anaconda3/lib/python3.11/site-packages/cassiopeia/core/patch.py:53, in Patch.from_str(cls, string, region)
50 @classmethod
51 def from_str(cls, string: str, region: Union[Region, str]) -> "Patch":
52 if not cls.__patches:
---> 53 cls.load()
54 if not isinstance(region, Region):
55 region = Region(region)

File ~/anaconda3/lib/python3.11/site-packages/cassiopeia/core/patch.py:85, in Patch.load(cls)
83 @classmethod
84 def load(cls):
---> 85 data = configuration.settings.pipeline.get(PatchListDto, query={})
86 patches = data["patches"]
87 shifts = data["shifts"]

File ~/anaconda3/lib/python3.11/site-packages/datapipelines/pipelines.py:459, in DataPipeline.get(self, type, query)
457 for handler in handlers:
458 try:
--> 459 return handler.get(query, context)
460 except NotFoundError:
461 pass

File ~/anaconda3/lib/python3.11/site-packages/datapipelines/pipelines.py:185, in _SourceHandler.get(self, query, context)
170 def get(self, query: Mapping[str, Any], context: PipelineContext = None) -> T:
171 """Gets a query from the data source.
172
173 1) Extracts the query from the data source.
(...)
183 The requested object.
184 """
--> 185 result = self._source.get(self._source_type, deepcopy(query), context)
186 LOGGER.info("Got result "{result}" from query "{query}" of source "{source}"".format(result=result, query=query, source=self._source))
188 LOGGER.info("Sending result "{result}" to sinks before converting".format(result=result))

File ~/anaconda3/lib/python3.11/site-packages/datapipelines/sources.py:69, in DataSource.dispatch..wrapper(self, type, query, context)
67 call = dispatcher.dispatch(type)
68 try:
---> 69 return call(self, query, context=context)
70 except TypeError:
71 raise DataSource.unsupported(type)

File ~/anaconda3/lib/python3.11/site-packages/cassiopeia/datastores/merakianalyticscdn.py:60, in MerakiAnalyticsCDN.get_patch_list(self, query, context)
58 try:
59 body = self._client.get(url)[0]
---> 60 body = json.decode(body)
61 except HTTPError as e:
62 raise NotFoundError(str(e)) from e

JSONDecodeError: Expected object or value

@jasonz2526
Copy link
Author

This also occurs with the following: Participant.summoner_spell_d, Participant.summoner_spell_f, and Participant.runes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant