Closed rajjeet closed 4 years ago
Hi, can you please provide the replay file? DE support is a bit rough right now since there is not a lot of sample data available.
https://drive.google.com/open?id=1Oh8d8WSk0M44Qyk9q9T4qgD-oxsITlUA
I wanted to build an offline analytical tool, trying to parse the binary file.
Thanks for the rec. I've replicated the issue. Something has recently changed in the DE rec structure. I will attempt to update the parser.
I took a look at the rec. Player 2 is an AI, which changes how the initial struct is formatted (mgz/header/de.py
). I attempted a few things to get it working, but there's more complexity than I have time right now.
Human-only recs are working (I fixed a few other issues as indicated in my previous response).
Tried with this replay with a multiplayer 1v1 ranked de: https://drive.google.com/open?id=1k-61dFAEc-bFBqRfNEK22IwqXnn4ysMe
Got this exception:
Traceback (most recent call last):
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 2844, in _decode
return self.decoding[obj]
KeyError: 4
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 1042, in _parse
obj.append(self.subcon._parse(stream, context._, path))
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 311, in _parse
return self._decode(self.subcon._parse(stream, context, path), context)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 2849, in _decode
raise MappingError("no decoding mapping for %r" % (obj,))
construct.core.MappingError: no decoding mapping for 4
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 2784, in _parse
return self.subcon._parse(stream, context, path)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 867, in _parse
subobj = sc._parse(stream, context, path)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 1050, in _parse
raise RangeError("expected %d to %d, found %d" % (min, max, len(obj)))
construct.core.RangeError: expected 7 to 7, found 3
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 1042, in _parse
obj.append(self.subcon._parse(stream, context._, path))
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 2784, in _parse
return self.subcon._parse(stream, context, path)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 867, in _parse
subobj = sc._parse(stream, context, path)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 2788, in _parse
raise e.__class__("%s\n %s" % (e, path))
construct.core.RangeError: expected 7 to 7, found 3
(parsing) -> initial -> players -> attributes
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 2784, in _parse
return self.subcon._parse(stream, context, path)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 867, in _parse
subobj = sc._parse(stream, context, path)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 1050, in _parse
raise RangeError("expected %d to %d, found %d" % (min, max, len(obj)))
construct.core.RangeError: expected 7 to 7, found 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "app.py", line 6, in <module>
header.parse_stream(data)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 171, in parse_stream
return self._parse(stream, context2, "(parsing)")
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 867, in _parse
subobj = sc._parse(stream, context, path)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 295, in _parse
return self.subcon._parse(stream, context, path)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 867, in _parse
subobj = sc._parse(stream, context, path)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 295, in _parse
return self.subcon._parse(stream, context, path)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\mgz\util.py", line 36, in _parse
return self.subcon._parse(new_stream, context, path)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 357, in _parse
return self.subcon.parse(data, context)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 158, in parse
return self.parse_stream(BytesIO(data), context, **kw)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 171, in parse_stream
return self._parse(stream, context2, "(parsing)")
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 867, in _parse
subobj = sc._parse(stream, context, path)
File "C:\Users\rajje\PycharmProjects\helloworld\venv\lib\site-packages\construct\core.py", line 2788, in _parse
raise e.__class__("%s\n %s" % (e, path))
construct.core.RangeError: expected 7 to 7, found 0
(parsing) -> initial
Process finished with exit code 1
Also, do you have a DE replay that works with this parser? Thanks for this work btw.
Hi, can you please provide the replay file? DE support is a bit rough right now since there is not a lot of sample data available.
What kind of sample data would you prefer?
Also, do you have a DE replay that works with this parser? Thanks for this work btw.
This one can be parsed successfully. (only summary
module, the parse_stream
seems to have some problems right now)
@chesteripz With the MP replay I linked, I'm getting an error while trying parse the header or the body using the following code:
from mgz import header, body
from os import fstat
with open('./mp-replay.aoe2record', 'rb') as data:
eof = fstat(data.fileno()).st_size
header.parse_stream(data)
while data.tell() < eof:
body.operation.parse_stream(data)
I'm on python @3.6.2
I'm tracking this issue. Thanks for reporting.
@rajjeet Took a look at your rec, mp-replay.aoe2record
. It's from an older version of DE. Commit 247c246a77a27e55d33990019e63b1da17c86105 can parse it. DE rec formats change somewhat frequently and this module isn't backwards compatible (theoretically it could be, but that's more work than I care to do). I expect the format to stabilize soon anyway. Also, FYI, that rec is an unranked lobby-hosted 3v3, not a ranked 1v1. Sorry you're having so much trouble getting this to work!
@chesteripz By sample data I just mean recs, ideally in bulk. The rec you posted should work with parse_stream
, let me know what problem you're having.
When I try to use parse_stream
, I've got the same error
never mind, I opened the older file
Closing. Feel free to re-open if you're still experiencing an issue.
Tried the following code:
Go this error: