sc2reader
sc2reader copied to clipboard
Cant process the replays generated by python-sc2
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
here is replay file: replays.zip
IndexError issues: https://github.com/ggtracker/sc2reader/issues?q=is%3Aissue+is%3Aopen+indexerror
All four issues point to the same line of code.
Thank you sir, but it is hard to find how to solve this problem,is this problem still existence?
Right, so I think the comment linking points to a general issue that the sc2reader library assumes that these replays were generated off of actually played games. Those games have things like server details and such that are pulled into the library. Since you said that python-sc2 to simulate the games, I suspect that some of these details aren't present.
A possible fix here is to see if you can bypass these lines if the cache handles aren't present. However, I'm not sure how many other places make the same assumption or if you will run into more problems down the line.
If you do get it working assuming that these details are optional, you're welcome to open a PR for it!