[PyQt] Strange error with QtBluetooth.QLowEnergyService
Florian Bruhin
me at the-compiler.org
Thu Nov 7 13:54:11 GMT 2019
On Thu, Nov 07, 2019 at 02:43:00PM +0100, s.achterop at rug.nl wrote:
> Hello list,
>
> I am working on a BLE app on PyQt5 and am getting an error I don't understand.
>
> With the following snippet:
>
> from PyQt5 import QtBluetooth as QtBt
>
> QtBt.QLowEnergyService.writeCharacteristic(QtBt.QLowEnergyCharacteristic.Unknown, 'asdf')
>
> I get the following error:
>
> TypeError: writeCharacteristic(self, QLowEnergyCharacteristic, Union[QByteArray, bytes, bytearray], ...
> ... mode: QLowEnergyService.WriteMode = QLowEnergyService.WriteWithResponse): first argument of unbound method must have type 'QLowEnergyService'
>
> But from what I see, the type is correct.
> What am doing wrong here?
You're calling a method which is intended to be called on an instance on a
class instead.
You should get a QLowEnergyService instance from somewhere, and call
writeCharacteristic on that.
Florian
--
https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP)
GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20191107/c545f48b/attachment.sig>
More information about the PyQt
mailing list