Python 2.7 使用XBee 2.1.0的随机异常
我有一个运行python应用程序的raspberry pi,它只是发送一个数据包并等待响应。问题是,我随机得到以下异常:Python 2.7 使用XBee 2.1.0的随机异常,python-2.7,raspberry-pi,xbee,Python 2.7,Raspberry Pi,Xbee,我有一个运行python应用程序的raspberry pi,它只是发送一个数据包并等待响应。问题是,我随机得到以下异常: Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner self.run() File "/usr/local/lib/python2.7
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 95, in run
self._callback(self.wait_read_frame())
File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 399, in wait_read_frame
frame = self._wait_for_frame()
File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 131, in _wait_for_frame
byte = self.serial.read()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 456, in read
raise SerialException('device reports readiness to read but returned no data (device disconnected?)')
SerialException: device reports readiness to read but returned no data (device disconnected?)
有人知道这是为什么吗?和你知道我能做些什么来修复它吗?我试着用Try:Except,但没用
非常感谢 过了一会儿,我才发现问题出现了,因为我的XBee是通过USB连接的。我直接将它改为串行,它已经运行了几个月没有任何问题