happyleavesaoc/aoc-mgz

error: construct.core.PaddingError: subcon parsed more bytes than was allowed by length

Closed this issue · 4 comments

https://github.com/happyleavesaoc/aoc-mgz/issues/55?ref=https://giter.site
I had the same issue.

I had the same problem.
I'm getting the same error with the latest source code after the bug was fixed.

command
import os
from mgz import header, body

with open('C:/Users/yoshi/Games/Age of Empires 2 DE/76561199387650333/savegame/error.aoe2record', 'rb') as data:
eof = os.fstat(data.fileno()).st_size
header.parse_stream(data)
body.meta.parse_stream(data)
while data.tell() < eof:
body.operation.parse_stream(data)

Traceback (most recent call last):
File "C:\Users\yoshi\AppData\Local\Programs\Python\Python311\Lib\site-packages\construct-2.8.16-py3.11.egg\construct\core.py", line 2784, in _parse
File "C:\Users\yoshi\AppData\Local\Programs\Python\Python311\Lib\site-packages\construct-2.8.16-py3.11.egg\construct\core.py", line 867, in _parse
File "C:\Users\yoshi\AppData\Local\Programs\Python\Python311\Lib\site-packages\construct-2.8.16-py3.11.egg\construct\core.py", line 1234, in _parse
construct.core.PaddingError: subcon parsed more bytes than was allowed by length

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 6, in
File "C:\Users\yoshi\AppData\Local\Programs\Python\Python311\Lib\site-packages\construct-2.8.16-py3.11.egg\construct\core.py", line 171, in parse_stream
File "C:\Users\yoshi\AppData\Local\Programs\Python\Python311\Lib\site-packages\construct-2.8.16-py3.11.egg\construct\core.py", line 2784, in _parse
File "C:\Users\yoshi\AppData\Local\Programs\Python\Python311\Lib\site-packages\construct-2.8.16-py3.11.egg\construct\core.py", line 867, in _parse
File "C:\Users\yoshi\AppData\Local\Programs\Python\Python311\Lib\site-packages\construct-2.8.16-py3.11.egg\construct\core.py", line 295, in _parse
File "C:\Users\yoshi\AppData\Local\Programs\Python\Python311\Lib\site-packages\construct-2.8.16-py3.11.egg\construct\core.py", line 2784, in _parse
File "C:\Users\yoshi\AppData\Local\Programs\Python\Python311\Lib\site-packages\construct-2.8.16-py3.11.egg\construct\core.py", line 1594, in _parse
File "C:\Users\yoshi\AppData\Local\Programs\Python\Python311\Lib\site-packages\construct-2.8.16-py3.11.egg\construct\core.py", line 2788, in _parse
construct.core.PaddingError: subcon parsed more bytes than was allowed by length
(parsing) -> operation -> data -> action

error.zip
Here is the replay file where the error occurs.

Use fast parse for the body operations

There was a description that complete data acquisition is not possible with fast, but once it was supported with fast.
no more error.
is this a specification?

Sorry, there is some nuance:

  • header: full will always work, has all data (fast works most of the time only)
  • body: fast will always work (full is deprecated now)

I should update the documentation ...

Thanks!