andrewsnowden / dota2py

Python tools for Dota 2
MIT License
115 stars 36 forks source link

IndexError: Unknown user message cmd: 100 #4

Closed fables-tales closed 11 years ago

fables-tales commented 11 years ago

I'm parsing the attached replay using dota2py.summary.DemoSummary using the following code snippet


class GameResult:
    def __init__(self, filename):
        self._dem_parser = dota2py.summary.DemoSummary(filename)
        self._dem_parser.parse()
        self._dem_parser.print_info()

Replay at: http://samphippen.com/58905427.dem and I'm getting the following error trace

Parsing demo 'replays/58905427.dem' for game information
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-2-5cc1d0c889f8> in <module>()
----> 1 esult = meepo.GameResult("replays/58905427.dem")

/Users/sam/dev/meepo/meepo/game_result.pyc in __init__(self, filename)
      4     def __init__(self, filename):
      5         self._dem_parser = dota2py.summary.DemoSummary(filename)
----> 6         self._dem_parser.parse()
      7         self._dem_parser.print_info()
      8 

/Users/sam/dev/meepo/venv/lib/python2.7/site-packages/dota2py/summary.pyc in parse(self)
    206                 self.parse_overhead_event,
    207         })
--> 208         self.dp.parse()
    209 
    210         for hero, player in self.heroes.iteritems():

/Users/sam/dev/meepo/venv/lib/python2.7/site-packages/dota2py/parser.pyc in parse(self)
    318                 self.worthless(message)
    319 
--> 320                 self.run_hooks(message)
    321 
    322                 self.info('|%s' % ('-' * 79, ))

/Users/sam/dev/meepo/venv/lib/python2.7/site-packages/dota2py/parser.pyc in run_hooks(self, packet)
    185 
    186         if packet.__class__ in self.internal_hooks:
--> 187             self.internal_hooks[packet.__class__](packet)
    188 
    189         if packet.__class__ in self.hooks:

/Users/sam/dev/meepo/venv/lib/python2.7/site-packages/dota2py/parser.pyc in parse_demo_packet(self, packet)
    238             self.worthless(message)
    239 
--> 240             self.run_hooks(message)
    241 
    242     def parse_user_message(self, message):

/Users/sam/dev/meepo/venv/lib/python2.7/site-packages/dota2py/parser.pyc in run_hooks(self, packet)
    185 
    186         if packet.__class__ in self.internal_hooks:
--> 187             self.internal_hooks[packet.__class__](packet)
    188 
    189         if packet.__class__ in self.hooks:

/Users/sam/dev/meepo/venv/lib/python2.7/site-packages/dota2py/parser.pyc in parse_user_message(self, message)
    243         cmd = message.msg_type
    244         if cmd not in messages.COMBINED_USER_MESSAGE_TYPES:
--> 245             raise IndexError("Unknown user message cmd: %s" % (cmd, ))
    246 
    247         reader = Reader(StringIO(message.msg_data))

IndexError: Unknown user message cmd: 100
andrewsnowden commented 11 years ago

I suspect this is because of some new updates to the replay format. I'll try and have a look at this on Monday and update the parser with all the new information they have added recently.

fables-tales commented 11 years ago

thanks @andrewsnowden :rainbow: :+1: :beers: :hibiscus:

andrewsnowden commented 11 years ago

I've updated the protobuf files and a few bits of code, would you mind running it again and see if you still get the error?

fables-tales commented 11 years ago

That has fixed it as far as I can tell. Thanks :cherry_blossom: