Esempio n. 1
0
 def send(self, message):
     message_id, command, arguments = parse_message(message)
     if command in self.known_commands:
         try:
             retval = getattr(self, "cmd_" + command)(arguments)
             response = gtp.format_success(message_id, retval)
             sys.stderr.flush()
             return response
         except ValueError as exception:
             return gtp.format_error(message_id, exception.args[0])
     else:
         return gtp.format_error(message_id, "unknown command: " + command)
Esempio n. 2
0
 def send(self, message):
     message_id, command, arguments = parse_message(message)
     if command in self.known_commands:
         try:
             retval = getattr(self, "cmd_" + command)(arguments)
             response = gtp.format_success(message_id, retval)
             sys.stderr.flush()
             return response
         except ValueError as exception:
             return gtp.format_error(message_id, exception.args[0])
     else:
         return gtp.format_error(message_id, "unknown command: " + command)