Skip to content
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

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

Closed
yoshi3241 opened this issue Feb 21, 2023 · 4 comments

Comments

@yoshi3241
Copy link

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
Copy link
Owner

Use fast parse for the body operations

@yoshi3241
Copy link
Author

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
Copy link
Owner

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

@yoshi3241
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants