ValvePython / dota2

🐸 Python package for interacting with Dota 2 Game Coordinator
http://dota2.readthedocs.io
204 stars 32 forks source link

Protobuff problem when launching #27

Closed phikui closed 7 years ago

phikui commented 7 years ago

On my Linux Server I get the following error when trying to create an instance

Traceback (most recent call last):
  File "dota-bot.py", line 14, in <module>
    import steam_wrapper
  File "/home/phil/dota-telegram-bot/steam_wrapper.py", line 5, in <module>
    dota = Dota2Client(client)
  File "/usr/local/lib/python2.7/dist-packages/dota2/__init__.py", line 11, in __new__
    from dota2.client import Dota2Client as D2C
  File "/usr/local/lib/python2.7/dist-packages/dota2/client.py", line 14, in <module>
    from dota2.features import FeatureBase
  File "/usr/local/lib/python2.7/dist-packages/dota2/features/__init__.py", line 1, in <module>
    from dota2.features.player import Player
  File "/usr/local/lib/python2.7/dist-packages/dota2/features/player.py", line 2, in <module>
    from dota2.enums import EDOTAGCMsg
  File "/usr/local/lib/python2.7/dist-packages/dota2/enums.py", line 30, in <module>
    _proto_module = __import__("dota2.protobufs", globals(), locals(), _proto_modules, 0)
  File "/usr/local/lib/python2.7/dist-packages/dota2/protobufs/base_gcmessages_pb2.py", line 17, in <module>
    import dota2.protobufs.steammessages_pb2 as steammessages__pb2
  File "/usr/local/lib/python2.7/dist-packages/dota2/protobufs/steammessages_pb2.py", line 26, in <module>
    dependencies=[google_dot_protobuf_dot_descriptor__pb2.DESCRIPTOR,])
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/descriptor.py", line 824, in __new__
    return _message.default_pool.AddSerializedFile(serialized_pb)
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "steammessages.proto":
  CMsgProtoBufHeader.target_job_name: "CMsgProtoBufHeader.target_job_name" is already defined in file "steammessages_base.proto".
  CMsgProtoBufHeader.eresult: "CMsgProtoBufHeader.eresult" is already defined in file "steammessages_base.proto".
  CMsgProtoBufHeader.error_message: "CMsgProtoBufHeader.error_message" is already defined in file "steammessages_base.proto".
  CMsgProtoBufHeader: "CMsgProtoBufHeader" is already defined in file "steammessages_base.proto".
  msgpool_soft_limit: "msgpool_soft_limit" is already defined in file "steammessages_base.proto".
  msgpool_hard_limit: "msgpool_hard_limit" is already defined in file "steammessages_base.proto".

On my laptop however it works fine.

rossengeorgiev commented 7 years ago

What packages do you have installed? steam and dota2? Do you have csgo one?

You probably installed the binary package protobuf package on your linux server. Let me know what the setup is so I can try and replicate this.

In the mean time, you can try:


pip uninstall protobuf
pip install --no-binary protobuff protobuf
phikui commented 7 years ago

I have steam and dota2 not csgo. I tried reinstalling protobuf, like you suggested, it did not help.

phikui commented 7 years ago

I was able to resolve the issue by force installing protobuf version 3.1.0. So the issue seems to arise with version 3.2.0. I was able to replicate that on a different computer as well.

rossengeorgiev commented 7 years ago

I can confirm the issue on linux. This is due to the protobuf binary wheel. The current work around is to install the pure python implementation.

pip uninstall protobuf
pip install --no-binary protobuff protobuf
rossengeorgiev commented 7 years ago

Issue should be fixed now. You should be able to use protobuf bin wheels