Code Monkey home page Code Monkey logo

Comments (12)

happyleavesaoc avatar happyleavesaoc commented on August 28, 2024

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.

from aoc-mgz.

rajjeet avatar rajjeet commented on August 28, 2024

https://drive.google.com/open?id=1Oh8d8WSk0M44Qyk9q9T4qgD-oxsITlUA

I wanted to build an offline analytical tool, trying to parse the binary file.

from aoc-mgz.

happyleavesaoc avatar happyleavesaoc commented on August 28, 2024

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.

from aoc-mgz.

happyleavesaoc avatar happyleavesaoc commented on August 28, 2024

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).

from aoc-mgz.

rajjeet avatar rajjeet commented on August 28, 2024

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

from aoc-mgz.

rajjeet avatar rajjeet commented on August 28, 2024

Also, do you have a DE replay that works with this parser? Thanks for this work btw.

from aoc-mgz.

chesteripz avatar chesteripz commented on August 28, 2024

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)

MP Replay v101.101.34793.0 @2020.02.13 213505 (1).zip

from aoc-mgz.

rajjeet avatar rajjeet commented on August 28, 2024

@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

from aoc-mgz.

happyleavesaoc avatar happyleavesaoc commented on August 28, 2024

I'm tracking this issue. Thanks for reporting.

from aoc-mgz.

happyleavesaoc avatar happyleavesaoc commented on August 28, 2024

@rajjeet Took a look at your rec, mp-replay.aoe2record. It's from an older version of DE. Commit 247c246 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.

from aoc-mgz.

chesteripz avatar chesteripz commented on August 28, 2024

When I try to use parse_stream, I've got the same error

never mind, I opened the older file

from aoc-mgz.

happyleavesaoc avatar happyleavesaoc commented on August 28, 2024

Closing. Feel free to re-open if you're still experiencing an issue.

from aoc-mgz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.