ggtracker / ggtracker/sc2reader

Cant process the replays generated by python-sc2

Open
#199 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
169
Forks
152
PR merge metrics
No merged PRs in 30d

Description

I have writed some botai to play starcraft2 by python-sc2,and i find sc2reader cant process these replays.
python version:3.10
sc2reader version:1.8.0
python-sc2 version: 6.5.0

code is here:

import sc2reader
replay = sc2reader.load_replay('Altitude LE_20230903_161615_PROTOSS_VS_BUILD_IN_AI_MediumHard_Zerg_process_-5_checked.SC2Replay')

print(replay.players)

here is my error:

Traceback (most recent call last):
File "E:\python_code\sc2data_process\process_replay\process_replay\test_sc2reader.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:\anaconda\envs\sc2env\lib\site-packages\sc2reader\factories\sc2factory.py", line 88, in load_replay
return self.load(Replay, source, options, **new_options)
File "E:\anaconda\envs\sc2env\lib\site-packages\sc2reader\factories\sc2factory.py", line 166, in load
return self._load(cls, resource, filename=filename, options=options)
File "E:\anaconda\envs\sc2env\lib\site-packages\sc2reader\factories\sc2factory.py", line 175, in _load
obj = cls(resource, filename=filename, factory=self, **options)
File "E:\anaconda\envs\sc2env\lib\site-packages\sc2reader\resources.py", line 302, in init
self.load_all_details()
File "E:\anaconda\envs\sc2env\lib\site-packages\sc2reader\resources.py", line 444, in load_all_details
self.load_details()
File "E:\anaconda\envs\sc2env\lib\site-packages\sc2reader\resources.py", line 389, in load_details
self.region = details["cache_handles"][0].server.lower()
IndexError: list index out of range

here is replay file:
replays.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with Python 3.10, sc2reader 1.8.0, python-sc2 6.5.0, and the attached replay. Read sc2reader/resources.py around load_details and load_all_details, especially the cache_handles access that raises IndexError. Done means the supplied replay loads successfully and replay.players can be printed without that error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.