747929791 / MajsoulAI

以JianYangAI作后端,进行在线雀魂对局
MIT License
265 stars 59 forks source link

进入对局后报错(更新proto后仍报错) #44

Open Missdrop opened 2 years ago

Missdrop commented 2 years ago

使用了-level 1 命令 在AI自动点击银之间按钮之后AI报错,经多次测试仍出现相同情况 报错信息如下


  majsoul menu not found, calibrate again]
  Number of good matches: 1071
  Homography Matrix: [[ 8.18263740e-01 -1.19836177e-03  6.32067758e+00]
 [-2.10630195e-03  8.22187602e-01  1.73237682e+02]
 [-3.05598975e-06 -5.09500683e-07  1.00000000e+00]]
Similarity: 0.7084269662921349
create AI subprocess locally
starting up on 127.0.0.1 port 7479
waiting for the AI
AI connection:  <class 'socket.socket'> <socket.socket fd=1404, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 7479), raddr=('127.0.0.1', 56918)> ('127.0.0.1', 56918)
waiting for the game to start
Traceback (most recent call last):
  File "main.py", line 744, in <module>
    MainLoop(level=level)
  File "main.py", line 705, in MainLoop
    while not aiWrapper.isPlaying():
  File "main.py", line 107, in isPlaying
    result = liqiProto.parse(flow_msg)
  File "C:\Desktop\MajsoulAI\majsoul_wrapper\liqi.py", line 84, in parse
    proto_domain = self.jsonProto['nested'][lq]['nested'][service]['methods'][rpc]
KeyError: 'fetchLastPrivacy'
Missdrop commented 2 years ago

更新liqi_pb2.py后运行报错


Traceback (most recent call last):
  File "C:\Desktop\MajsoulAI\majsoul_wrapper\sdk.py", line 17, in <module>
    from liqi import LiqiProto, MsgType
ModuleNotFoundError: No module named 'liqi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Desktop\MajsoulAI\majsoul_wrapper\liqi.py", line 20, in <module>
    from .proto import liqi_pb2 as pb
  File "C:\Desktop\MajsoulAI\majsoul_wrapper\proto\liqi_pb2.py", line 22, in <module>
    create_key=_descriptor._internal_create_key,
AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\software\Python\Python37\lib\runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "D:\software\Python\Python37\lib\runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "D:\software\Python\Python37\lib\runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "C:\Desktop\MajsoulAI\majsoul_wrapper\__init__.py", line 5, in <module>
    from .sdk import MajsoulHandler, Operation, all_tiles
  File "C:\Desktop\MajsoulAI\majsoul_wrapper\sdk.py", line 19, in <module>
    from .liqi import LiqiProto, MsgType
  File "C:\Desktop\MajsoulAI\majsoul_wrapper\liqi.py", line 22, in <module>
    from proto import liqi_pb2 as pb
ModuleNotFoundError: No module named 'proto'
nicognaW commented 2 years ago

你应该使用项目对应的protobuf版本转换你的proto文件,请参考 https://github.com/747929791/majsoul_wrapper/pull/13 。这是因为protobuf不支持将新版本程序生成的文件应用在旧版本运行时上。