每次我尝试运行代码的服务器功能时,无论我在什么代码上运行,我都会不断收到此错误。我已经在我的ubuntu笔记本电脑和树莓派上都尝试过。
Traceback (most recent call last): File "/home/soham/.local/lib/python3.6/site-packages/bluetooth/bluez.py", line 167, in accept
client, addr = self._sock.accept ()
_bluetooth.error: (11, 'Resource temporarily unavailable')
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "Multi.py", line 89, in <module>
server() File "Multi.py", line 31, in server
client_sock, client_info = sock.accept() File "/home/soham/.local/lib/python3.6/site-packages/bluetooth/bluez.py", line 169, in accept
raise BluetoothError (str (e)) bluetooth.btcommon.BluetoothError: (11, 'Resource temporarily unavailable')
有问题的代码段如下:
def server():
sock.bind(("", port))
sock.setblocking(False)
sock.listen(1)
name = "lights"
print("Awaiting connection")
BLE.advertise_service(sock, name)
client_sock, client_info = sock.accept()
print("Accepted connection from ", client_info)
order = int(client_sock.recv(1024))
print("order is ", order)
message(order, client_sock)