windows10+Python3.9.6+pybluez2运行代码一直报OSError,求解答!


代码如下:
import bluetooth

server_sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM)

port = 1
server_sock.bind(("", port))
server_sock.listen(1)

client_sock, address = server_sock.accept()
print("Accepted connection from ", address)

data = client_sock.recv(1024)
print("received [%s]" % data)

client_sock.close()
server_sock.close()

运行结果如下:

Traceback (most recent call last):
  File "D:\PyCharm Community Edition 2021.2.2\xin\ye.py", line 6, in <module>
    server_sock.bind(("", port))
  File "D:\Python\lib\site-packages\bluetooth\msbt.py", line 60, in bind
    bt.bind (self._sockfd, addr, port)
OSError