ggtracker / sc2reader

Extracts gameplay information from Starcraft II replay files
http://pypi.python.org/pypi/sc2reader
MIT License
146 stars 143 forks source link

IndexError: list index out of range #97

Open NoviceYin opened 5 years ago

NoviceYin commented 5 years ago

Hi there

 When I tried load a replay by following line 

 replay = (AlphaStar_MaNa_Game_1.SC2Replay'), it shows index error. This replay is the match between Mana and AlphaStar, it can be downloaded from deepmind.  Also, other replays between alphastar and master players cannot be loaded. 

 I think it is because these matches had some mods?

 Thank you
StoicLoofah commented 5 years ago

Can you copy in the stack trace of the error? And provide a direct link to the replay?

You're likely correct that the problem is due to the nature of the replay. See #61 for another error we had processing non-standard replays. I believe that deepmind mentioned they were using a modded version of the SC2 client to get alphastar to play, so I'm not sure there's any easy solution for this.

NoviceYin commented 5 years ago

IndexError Traceback (most recent call last)

in 15 """ 16 replay = sc2reader.load_replay( ---> 17 '/Users/chenyinheng/Desktop/S2_2019/4560/alphastar_replys/AlphaStar_MaNa_Game_1.SC2Replay') 18 print("Replay successfully loaded.") ~/.local/lib/python3.7/site-packages/sc2reader/factories/sc2factory.py in load_replay(self, source, options, **new_options) 83 def load_replay(self, source, options=None, **new_options): 84 """Loads a single sc2replay file. Accepts file path, url, or file object.""" ---> 85 return self.load(Replay, source, options, **new_options) 86 87 def load_replays(self, sources, options=None, **new_options): ~/.local/lib/python3.7/site-packages/sc2reader/factories/sc2factory.py in load(self, cls, source, options, **new_options) 141 options = options or self._get_options(cls, **new_options) 142 resource, filename = self._load_resource(source, options=options) --> 143 return self._load(cls, resource, filename=filename, options=options) 144 145 def load_all(self, cls, sources, options=None, **new_options): ~/.local/lib/python3.7/site-packages/sc2reader/factories/sc2factory.py in _load(self, cls, resource, filename, options) 150 # Internal Functions 151 def _load(self, cls, resource, filename, options): --> 152 obj = cls(resource, filename=filename, factory=self, **options) 153 for plugin in options.get("plugins", self._get_plugins(cls)): 154 obj = plugin(obj) ~/.local/lib/python3.7/site-packages/sc2reader/resources.py in __init__(self, replay_file, filename, load_level, engine, do_tracker_events, **options) 300 for data_file in files: 301 self._read_data(data_file, self._get_reader(data_file)) --> 302 self.load_all_details() 303 self.datapack = self._get_datapack() 304 ~/.local/lib/python3.7/site-packages/sc2reader/resources.py in load_all_details(self) 443 self.load_init_data() 444 self.load_attribute_events() --> 445 self.load_details() 446 447 def load_map(self): ~/.local/lib/python3.7/site-packages/sc2reader/resources.py in load_details(self) 387 388 self.map_name = details["map_name"] --> 389 self.region = details["cache_handles"][0].server.lower() 390 self.map_hash = details["cache_handles"][-1].hash 391 self.map_file = details["cache_handles"][-1] IndexError: list index out of range The link of the replays is https://deepmind.com/research/open-source/alphastar-resources Thank you very much
StoicLoofah commented 5 years ago

Hmm, looks like not all relevant data is available. I wonder whether it would be possible just to treat references as optional (e.g. self.region = details['cache_handles'][0].server.lower() if details['cache_handles'] else None) and see if the underlying data is still good.

I can't say that I will get a chance to look at this soon, so if you (or anyone else) wants to take a shot at it, you're certainly welcome to

Zhai-Huichen commented 1 year ago

hi, did u solve this problem? I got this too .........................

StoicLoofah commented 1 year ago

hi, did u solve this problem? I got this too .........................

Are you also using alphastar replays? Can you link tot he replay you're using?