Closed Guimoute closed 2 years ago
Are you using the latest version of mgz
? You'll need to git clone
the repository to get it.
I updated construct
from 2.8.16 to 2.10.68 and now import mgz
causes an error, so I cannot check the version. I got it via pip
though, not on github. I'll try with github.
ImportError: cannot import name 'Embedded' from 'construct' (C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\construct\__init__.py)
Edit: it was mgz-1.7.3
that I got via pip. I am installing 1.7.4 right now.
I reverted the construct upgrade.
With a manual install of mgz-1.7.4
I have the three first examples that work. Examples 4 and 5 yield a different error now.
Traceback (most recent call last):
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\fast\header.py", line 463, in parse
players, mod = parse_players(header, num_players, version)
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\fast\header.py", line 430, in parse_players
players = [parse_player(header, number, num_players) for number in range(num_players)]
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\fast\header.py", line 430, in <listcomp>
players = [parse_player(header, number, num_players) for number in range(num_players)]
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\fast\header.py", line 116, in parse_player
name, resources = unpack(f'<{name_length - 1}s2xIx', header)
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\fast\header.py", line 33, in unpack
output = struct.unpack(fmt, data.read(struct.calcsize(fmt)))
struct.error: bad char in struct format
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "REDACTED/PATH/TO/MY/PROGRAM", line 49, in <module>
match = parse_match(data)
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\model\__init__.py", line 93, in parse_match
data = parse(handle)
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\fast\header.py", line 467, in parse
raise RuntimeError("could not parse")
RuntimeError: could not parse
Traceback (most recent call last):
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\fast\header.py", line 463, in parse
players, mod = parse_players(header, num_players, version)
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\fast\header.py", line 430, in parse_players
players = [parse_player(header, number, num_players) for number in range(num_players)]
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\fast\header.py", line 430, in <listcomp>
players = [parse_player(header, number, num_players) for number in range(num_players)]
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\fast\header.py", line 116, in parse_player
name, resources = unpack(f'<{name_length - 1}s2xIx', header)
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\fast\header.py", line 33, in unpack
output = struct.unpack(fmt, data.read(struct.calcsize(fmt)))
struct.error: bad char in struct format
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "REDACTED/PATH/TO/MY/PROGRAM", line 56, in <module>
match = parse_match(data)
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\model\__init__.py", line 93, in parse_match
data = parse(handle)
File "C:\WPy64-3870\python-3.8.7.amd64\lib\site-packages\mgz-1.7.4-py3.8.egg\mgz\fast\header.py", line 467, in parse
raise RuntimeError("could not parse")
RuntimeError: could not parse
All the dependencies were installed properly apparently.
Ok, now you are seeing expected behavior. 4 and 5 (relying on "fast mode") aren't compatible with the latest version of DE, yet. You'll want to use the "full mode"/Summary
to parse the latest recs.
Ok, thank you so much for your fast reply!
Hello,
For some reason, I cannot run any of the examples provided on the main page. Are there special requirements that are not listed? My python version is 3.8.7.
Here is a simple script that is used to test the five examples and log the error traceback to a file. All you need to change is
EXAMPLE = 1|2|3|4|5
in the constants.test.zip contains
test.aoe2record
.Manually looking at the header, this game has the following characteristics:
The 5 tracebacks are here: log_example_1.txt log_example_2.txt log_example_3.txt log_example_4.txt log_example_5.txt
The 5 top-most errors are:
Thank you in advance for your help.