我有一个运行python应用程序的覆盆子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/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但没有用。
非常感谢!
答案 0 :(得分:0)
过了一会儿,我才发现问题出现了,因为我的XBee是通过USB连接的。我直接将它改为串口,它已经运行了好几个月没有任何问题。