Hi I'm new here this is my first post.
I've been using sc2reader happily for few months in the first half of 2014.
I've already filed a issue on GitHub on a specific issue but now I'm writing here because I'm finding so many problems in trying to make it work again, that I'm wondering if it's completely broken or if it's a problem of mine, and I'd like some kind of general feedback on this.
So, to the point.
I am using a Mac, Yosemite OS.
Two days ago I started to use again my mid-2014-working installation of sc2reader (v0.6.5) running on python 2.7, and started to have three errors, after the third I stopped trying to fix things and come here.
I report them in order of appearance.
I am having these errors using the provided script sc2printer on the attached s2gs file.
I am NOT having these errors using sc2printer on the provided /test_s2gs/ files.
#1 - AttributeError: 'ByteDecoder' object has no attribute 'read_unit64'
The last two lines of the call stack trace are:
File "build/bdist.macosx-10.9-intel/egg/sc2reader/decoders.py", line 371, in read_struct
AttributeError: 'ByteDecoder' object has no attribute 'read_unit64'
Actually the error is there, if you look at line 371 of decoders.py you'll see this statement:
data = self._buffer.read_unit64()
Looking through decoders.py history, I find this error is there from the very first version.
So, question #1: is it really possible nobody in the world ever had to parse a s2gs file with a 64-bit data since march 7th 2013? It looks so strange to me...
Anyway, that was easy to fix and fixed by myself changing to "uint64()".
Launched again sc2printer and got this new one:
#2 - TypeError: ord() expected a character, but string of length 0 found
Again, last two lines of the call stack point us to decoders.py:
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 guilty line seems to be:
datatype = ord(self._buffer.read(1)) if datatype is None else datatype
That is not easy to understand for me.
It's not a typo, it has to do with inner working of all this stuff.
As far as I understand this, it looks like we're trying to read 1 byte while at EOF of our byte stream.
I tried to patch it up just to check for EOF before trying to decode to ord() and, if EOF, simply return a "NONE" datatype.
Hoping that calling code would handle such "None" datatype.
Of course that didn't happen and the error became "Unknown Data Structure: 'None'".
Again, I'm wondering I am the only person in the world having this strange issue?
BTW, I gave up on this and installed from github the latest "master" version (namely 0.7.0-pre).
But the errors (both) are still there.
Now, I'm stuck.
Did anyone have these errors? Or one of them?
Errors #1 and #2 looked really strange to me since it looks like the problem is in my replay, but it's an absolutely normal custom game.
I already filed an issue for #2.
Should I file an issue for #1 too?
Thanks