[PyQt] Connecting and sending a message in bluetooth using python and PyQt5

David Boddie david at boddie.org.uk
Sat Apr 18 09:52:59 BST 2020


On Sat Apr 18 08:43:13 BST 2020, Jason Friedman wrote:

> Thanks for taking the time to answer.

No problem.

> I found the problem - I was mixing "regular" Bluetooth and QtBluetooth.
> 
> In particular, this line:
>         self.sock = QtBluetooth.QBluetoothSocket(bluetooth.RFCOMM)
> 
> should have been:
>         self.sock = 
QtBluetooth.QBluetoothSocket(QtBluetooth.QBluetoothServiceInfo.RfcommProtocol)

Ah, I didn't see the constant. Yes, that would cause problems.

> > You are already creating and starting a QApplication instance in your main
> 
> code. Does removing this help at all?
> 
> Now the program works. And after I removed the duplicate calls to
> QApplication, it stopped crashing on exit also :)

Excellent!

David


More information about the PyQt mailing list