Please tell me why when I run the code I get an error? Here is the code:
import bluetooth bd_addr = "00:03:b9:b3:c1:38" port = 1 sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) sock.connect((bd_addr, port)) sock.send("hello!!") sock.close() But the error itself:
Traceback (most recent call last): File "D: \ Desktop \ parpar.py", line 8, in sock.connect ((bd_addr, port)) File "D: \ 2012 \ lib \ site-packages \ bluetooth \ msbt.py ", line 72, in connect bt.connect (self._sockfd, addr, port) OSError
My bluetooth adapter works and everything is fine with him. Tell me how to fix this error?
In short, I tried to change the version of the python to an older 2.7 and saw that errors at least explain something, unlike last time.
Here is my code that I launched and in which I got a result, as well as an error.
from bluetooth import * server_sock=BluetoothSocket( RFCOMM ) port = 0 server_sock.bind(("",PORT_ANY)) server_sock.listen(1) server=BluetoothSocket( RFCOMM ) server.connect(('00:11:22:98:76:54',PORT_ANY)) server.send("hello!!") server.close() client_sock,address = server_sock.accept() client_sock.close() server_sock.close() server.close() Traceback (most recent call last): File "D: \ Desktop \ fhg.py", line 9, in sock.connect ((bd_addr, PORT_ANY)) File "D: \ pythonchik \ lib \ site-packages \ bluetooth \ msbt.py ", line 72, in connect bt.connect (self._sockfd, addr, port) IOError: The required address for its context is incorrect.