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

bug: TypeError when fetching from MahjongSoul #26

Open
huantianad opened this issue Oct 7, 2024 · 0 comments
Open

bug: TypeError when fetching from MahjongSoul #26

huantianad opened this issue Oct 7, 2024 · 0 comments

Comments

@huantianad
Copy link

Using python 3.12.5,

certifi            2024.8.30
charset-normalizer 3.3.2
idna               3.10
pip                24.2
protobuf           5.28.2
python-dotenv      1.0.1
requests           2.32.3
urllib3            2.2.3
websockets         13.1

Steps to reproduce:

  1. Clone the repository.
  2. python -v venv venv && source ./venv/bin/activate && pip install python-dotenv websockets requests protobuf (though I can repro with pipenv)
  3. Setup mahjong soul credentials
  4. Run the program with python main.py -m both 'https://mahjongsoul.game.yo-star.com/?paipu=241007-b5e2e19a-1f97-4151-9b64-55be89d9d62e_a934178472'

Error:

/home/huantian/Downloads/InjusticeJudge/injustice_judge/fetch/majsoul.py:58: UserWarning: reflection.MakeClass() is deprecated. Please use MessageFactory.GetMessageClass() instead. reflection.MakeClass() will be removed in Jan 2025.
  req: Message = pb.reflection.MakeClass(method.input_type)(**fields)  # type: ignore[attr-defined]
/home/huantian/Downloads/InjusticeJudge/injustice_judge/fetch/majsoul.py:59: UserWarning: reflection.MakeClass() is deprecated. Please use MessageFactory.GetMessageClass() instead. reflection.MakeClass() will be removed in Jan 2025.
  res: Message = pb.reflection.MakeClass(method.output_type)()  # type: ignore[attr-defined]
Calling fetchGameRecord...
/home/huantian/Downloads/InjusticeJudge/injustice_judge/fetch/majsoul.py:135: UserWarning: reflection.MakeClass() is deprecated. Please use MessageFactory.GetMessageClass() instead. reflection.MakeClass() will be removed in Jan 2025.
  msg = pb.reflection.MakeClass(proto.DESCRIPTOR.message_types_by_name[name])()  # type: ignore[attr-defined]
Traceback (most recent call last):
  File "/home/huantian/Downloads/InjusticeJudge/main.py", line 124, in <module>
    main()
  File "/home/huantian/Downloads/InjusticeJudge/main.py", line 25, in main
    print("\n".join(asyncio.run(analyze_game(link, players, look_for=mode))))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/h3i0acpmr8mrjx07519xxmidv8mpax4y-python3-3.12.5/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/nix/store/h3i0acpmr8mrjx07519xxmidv8mpax4y-python3-3.12.5/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/h3i0acpmr8mrjx07519xxmidv8mpax4y-python3-3.12.5/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/huantian/Downloads/InjusticeJudge/injustice_judge/__init__.py", line 12, in analyze_game
    kyokus, game_metadata, players = await parse_game_link(link, specified_players)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/huantian/Downloads/InjusticeJudge/injustice_judge/fetch/__init__.py", line 36, in parse_game_link
    majsoul_log, metadata, player = await fetch_majsoul(link)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/huantian/Downloads/InjusticeJudge/injustice_judge/fetch/majsoul.py", line 185, in fetch_majsoul
    if parsed.actions != []:
       ^^^^^^^^^^^^^^^^^^^^
  File "/home/huantian/Downloads/InjusticeJudge/venv/lib/python3.12/site-packages/google/protobuf/internal/containers.py", line 79, in __ne__
    return not self == other
               ^^^^^^^^^^^^^
  File "/home/huantian/Downloads/InjusticeJudge/venv/lib/python3.12/site-packages/google/protobuf/internal/containers.py", line 328, in __eq__
    raise TypeError('Can only compare repeated composite fields against '
TypeError: Can only compare repeated composite fields against other repeated composite fields.

Fixes if i replace the if statement with just the first branch.

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

1 participant