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
411 stars 85 forks source link

"TypeError: ord() expected a character, but string of length 0 found" in decoders.py v0.6.5 #184

Open AldoErco opened 9 years ago

AldoErco commented 9 years ago

Hi. I am trying to decode s2gs files on Mac using sc2printer builtin script and get this error: "AttributeError: 'ByteDecoder' object has no attribute 'read_unit64'" It's related to line 371 of decoders.py where I can see: "data = self._buffer.read_unit64()" Reading the docs ("https://media.readthedocs.org/pdf/sc2reader/latest/sc2reader.pdf") on page 19 claims ByteDecoder is expected to have a read_uint64() and not a read_unit64() member. Ok so I unpack the .egg file, change that line and repack it. This is just a hint to you to fix it on your currently (0.6.5) published files. But now to the error I can't fix myself. This time I try to open a replay and get: "File "/Library/Python/2.7/site-packages/sc2reader-0.6.5-py2.7.egg/sc2reader/decoders.py", line 339, in read_struct TypeError: ord() expected a character, but string of length 0 found" The code line is: "datatype = ord(self._buffer.read(1)) if datatype is None else datatype" This time I don't know what to do.

Please help.

AldoErco commented 9 years ago

I follow up as requested by Graylin here (https://groups.google.com/forum/#!topic/sc2reader/FWzsVh5wQZ4)

It's not an occasional error, I am getting this on 45 files on a total of 117. I can provide them all if you need. Can I attach files here, or images only?

GraylinKim commented 9 years ago

If you rename to an image you can technically attach anything. Post a zip of the affected files somewhere and I'll take a look this week.

AldoErco commented 9 years ago

Ok the files are here: https://drive.google.com/open?id=0B-U0UqFTg0LET2dWWFh3REpqN1U&authuser=0

or here: https://www.dropbox.com/s/f9zu7f4ylnhf6wu/s2gs_files.zip?dl=0

The zipfile contains two self-explanatory directories "Error" and "Success".

Thanks a lot.