GraylinKim / sc2reader

A python library that extracts data from various Starcraft II resources to power tools and services for the SC2 community. Who doesn't want to hack on the games they play?
http://sc2reader.readthedocs.org
MIT License
413 stars 85 forks source link

'NoneType' object has no attribute 'split' on certain maps #68

Closed dsjoerg closed 12 years ago

dsjoerg commented 12 years ago

Happens on several of my replays, including: ggtracker.com/replays/205113/getreplay

guessing that

    game_strings = self.archive.read_file('enUS.SC2Data\LocalizedData\GameStrings.txt')

sometimes sets game_strings to None.

This causes sc2reader to die when parsing the replay.

sc2gears can't parse this one either.

2.2% of our replay sample can't parse because of this (12 out of 549).

GraylinKim commented 12 years ago

Ah I see. This was probably destined to be broken code. Of course not all maps have localized data for enUS.

A better solution is needed here but in the mean time I will check to see if the currently used file exists before attempting to use it. This of course means that the your code shouldn't rely on the map meta-data if you are supporting non US map files. The replay.map_name attribute is the map name derived from the replay and not the map file. It will be more reliable.

GraylinKim commented 12 years ago

I am considering this closed. Support for map meta data outside of the enUS localization can be considered a feature request at this point.

dsjoerg commented 12 years ago

Cool, I tried the replay mentioned in this Issue and it no longer dies in this way.