Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 of 2 changes to support bot replays in ggtracker#149 (#1)
* 1 of 2 changes to support bot replays in ggtracker#149 One of two fixes This one corrects for the error we see here: sc2reader/engine/plugins/context.py", line 66, in handleTargetUnitCommandEvent self.last_target_ability_event[event.player.pid] = event AttributeError: 'NoneType' object has no attribute 'pid' * Update sc2reader/engine/plugins/context.py Co-authored-by: Christian Clauss <[email protected]> --------- Co-authored-by: Christian Clauss <[email protected]>
- Loading branch information
e289f3a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this bug still occur,even if i have used this change
Traceback (most recent call last):
File "E:\python_code\starcraft2_data_process\process_replay\process_replay\process_ai_replay\test_01.py", line 2, in
replay = sc2reader.load_replay('Altitude LE_20230903_161615_PROTOSS_VS_BUILD_IN_AI_MediumHard_Zerg_process_-5_checked.SC2Replay')
File "E:\python_code\sc2reader-upstream\sc2reader\factories\sc2factory.py", line 85, in load_replay
return self.load(Replay, source, options, **new_options)
File "E:\python_code\sc2reader-upstream\sc2reader\factories\sc2factory.py", line 163, in load
return self._load(cls, resource, filename=filename, options=options)
File "E:\python_code\sc2reader-upstream\sc2reader\factories\sc2factory.py", line 172, in _load
obj = cls(resource, filename=filename, factory=self, **options)
File "E:\python_code\sc2reader-upstream\sc2reader\resources.py", line 342, in init
engine.run(self)
File "E:\python_code\sc2reader-upstream\sc2reader\engine\engine.py", line 183, in run
for new_event in event_handler(event, replay) or []:
File "E:\python_code\sc2reader-upstream\sc2reader\engine\plugins\context.py", line 129, in handleUpdateTargetUnitCommandEvent
if event.player.pid in self.last_target_ability_event:
AttributeError: 'NoneType' object has no attribute 'pid'
e289f3a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 66 and 129 are not the same line.
e289f3a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you sir, I reinstall the sc2reader from pypi.
Now the new error occurs here:
Traceback (most recent call last):
File "E:\python_code\starcraft2_data_process\process_replay\process_replay\process_ai_replay\test_01.py", line 2, in
replay = sc2reader.load_replay('Altitude LE_20230903_161615_PROTOSS_VS_BUILD_IN_AI_MediumHard_Zerg_process_-5_checked.SC2Replay')
File "F:\ide\anaconda\envs\sc2env\lib\site-packages\sc2reader\factories\sc2factory.py", line 88, in load_replay
return self.load(Replay, source, options, **new_options)
File "F:\ide\anaconda\envs\sc2env\lib\site-packages\sc2reader\factories\sc2factory.py", line 166, in load
return self._load(cls, resource, filename=filename, options=options)
File "F:\ide\anaconda\envs\sc2env\lib\site-packages\sc2reader\factories\sc2factory.py", line 175, in _load
obj = cls(resource, filename=filename, factory=self, **options)
File "F:\ide\anaconda\envs\sc2env\lib\site-packages\sc2reader\resources.py", line 346, in init
engine.run(self)
File "F:\ide\anaconda\envs\sc2env\lib\site-packages\sc2reader\engine\engine.py", line 179, in run
for new_event in event_handler(event, replay) or []:
File "F:\ide\anaconda\envs\sc2env\lib\site-packages\sc2reader\engine\plugins\context.py", line 93, in handleUpdateTargetUnitCommandEvent
if event.player.pid in self.last_target_ability_event:
AttributeError: 'NoneType' object has no attribute 'pid'
Due to my replays generated by python-sc2 botai pacakge, I hope you can help me to solve these bugs.
here is replay :
replays.zip