Python SocketServer.py错误

Python SocketServer.py错误,python,socketserver,osc,Python,Socketserver,Osc,有人能看出这里有什么问题吗?我是python新手,需要一些指导。 我正在使用Lion在mac上以32位模式运行Python 2.7.3。依赖项包括 皮奥斯克 pyserial 2.6 python xbee api 2.00 optparse_gui 0.2 wxPython 2.8 我将感谢任何帮助 OSCServer: KeyError on request from home.gateway:60537: 0 Traceback (most recent call last): Fil

有人能看出这里有什么问题吗?我是python新手,需要一些指导。 我正在使用Lion在mac上以32位模式运行Python 2.7.3。依赖项包括

皮奥斯克 pyserial 2.6 python xbee api 2.00 optparse_gui 0.2 wxPython 2.8

我将感谢任何帮助

OSCServer: KeyError on request from home.gateway:60537: 0
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 638, in __init__
    self.handle()
  File "/Library/Python/2.7/site-packages/OSC.py", line 1770, in handle
    self._unbundle(decoded)
  File "/Library/Python/2.7/site-packages/OSC.py", line 1761, in _unbundle
    self._unbundle(msg)
  File "/Library/Python/2.7/site-packages/OSC.py", line 1752, in _unbundle
    self.replies += self.server.dispatchMessage(decoded[0], decoded[1][1:], decoded[2:], self.client_address)
  File "/Library/Python/2.7/site-packages/OSC.py", line 1714, in dispatchMessage
    reply = self.callbacks[addr](pattern, tags, data, client_address)
  File "minihiveosc.py", line 74, in handler_output
    self.setOutput( args[0], args[1:] )
  File "minihiveosc.py", line 178, in setOutput
    self.hive.oscToMiniBee( mid, data )
  File "minihiveosc.py", line 330, in oscToMiniBee
    self.hive.bees[ nid ].send_output( self.hive.serial, data )
KeyError: 0

当您使用字典中不存在的键执行字典查找时,通常会引发
KeyError
异常。在本例中,它似乎位于最后一行:

self.hive.bees[ nid ].send_output( self.hive.serial, data )

…具体来说,
self.hive.bees[nid]
部分
nid
显然持有一个值
0
,而您的
self.hive.bees
字典中没有
0
键。

当您使用字典中不存在的键进行字典查找时,通常会引发
KeyError
异常。在本例中,它似乎位于最后一行:

self.hive.bees[ nid ].send_output( self.hive.serial, data )

…具体来说,
self.hive.bees[nid]
部分
nid
的值显然是
0
,而你的
self.hive.bees
字典中没有
0
键。

谢谢你的回答-我会调查的。谢谢你的回答-我会调查的。