ggtracker / sc2reader

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

AttributeError: 'Replay' object has no attribute 'expansion' #49

Closed bearxu83 closed 6 years ago

bearxu83 commented 6 years ago

https://github.com/ggtracker/sc2reader/blob/5f189ae405af066f0beb99793ab70668979084b7/sc2reader/resources.py#L184

I think here it is a typo that misspells "expansion".

StoicLoofah commented 6 years ago

Good find! Can you submit a PR to fix it?

bearxu83 commented 6 years ago

It seems that now the sc2reader can't parse the official replay packs released by sc2 official machine learning api because these replay packs hide much basic information. I will try to use sc2protocol first then I will try to see how to fix them.

I don't know why sc2reader don't use sc2protocol to parse the replay files.

dsjoerg commented 6 years ago

@bearxu83 it's because sc2reader was written long before s2protocol existed

JohnSegerstedt commented 5 years ago

The issue is still not solved. Installed sc2reader today and got the following error:

RESTART: C:/Users/John/Desktop/Chalmers/year3/LP3=DATX02_Bachelor_Thesis/DATX02/sc2reader_python/prettyPrinter.py Traceback (most recent call last): File "C:/Users/John/Desktop/Chalmers/year3/LP3=DATX02_Bachelor_Thesis/DATX02/sc2reader_python/prettyPrinter.py", line 31, in main() File "C:/Users/John/Desktop/Chalmers/year3/LP3=DATX02_Bachelor_Thesis/DATX02/sc2reader_python/prettyPrinter.py", line 27, in main replay = sc2reader.load_replay(path) File "C:\Program Files\Python36\lib\site-packages\sc2reader-0.7.0rc0-py3.6.egg\sc2reader\factories\sc2factory.py", line 85, in load_replay return self.load(Replay, source, options, new_options) File "C:\Program Files\Python36\lib\site-packages\sc2reader-0.7.0rc0-py3.6.egg\sc2reader\factories\sc2factory.py", line 137, in load return self._load(cls, resource, filename=filename, options=options) File "C:\Program Files\Python36\lib\site-packages\sc2reader-0.7.0rc0-py3.6.egg\sc2reader\factories\sc2factory.py", line 146, in _load obj = cls(resource, filename=filename, factory=self, options) File "C:\Program Files\Python36\lib\site-packages\sc2reader-0.7.0rc0-py3.6.egg\sc2reader\resources.py", line 273, in init self.datapack = self._get_datapack() File "C:\Program Files\Python36\lib\site-packages\sc2reader-0.7.0rc0-py3.6.egg\sc2reader\resources.py", line 593, in _get_datapack if callback(self): File "C:\Program Files\Python36\lib\site-packages\sc2reader-0.7.0rc0-py3.6.egg\sc2reader\resources.py", line 581, in self.register_datapack(datapacks['HotS']['24764'], lambda r: r.expansion == 'HotS' and 24764 <= r.build) AttributeError: 'Replay' object has no attribute 'expansion'

And if I check the resources.py file, expansion is still misspelled.

cclauss commented 5 years ago

Which line number in resources.py?

StoicLoofah commented 5 years ago

@JohnSegerstedt it appears that you're using an outdated version of sc2reader. The path in your stack trace says 0.7.0rc0 whereas we're currently on version 1.3.1

How did you install sc2reader? It's possible that you may have followed outdated installation instructions, in which case we can provide new ones