New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RangeError: expected 50 to 50, found 0 #10
Comments
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 ( 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. |
What kind of sample data would you prefer?
This one can be parsed successfully. (only |
@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, @chesteripz By sample data I just mean recs, ideally in bulk. The rec you posted should work with |
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:
The text was updated successfully, but these errors were encountered: