happyleavesaoc / aoc-mgz

Age of Empires II recorded game parsing and summarization in Python 3.
MIT License
197 stars 41 forks source link

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

Closed yoshi3241 closed 1 year ago

yoshi3241 commented 1 year ago

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.

happyleavesaoc commented 1 year ago

Use fast parse for the body operations

yoshi3241 commented 1 year ago

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?

happyleavesaoc commented 1 year ago

Sorry, there is some nuance:

I should update the documentation ...

yoshi3241 commented 1 year ago

Thanks!