Re: Strange error with QtBluetooth.QLowEnergyService
Florian Bruhin <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Nov 07, 2019 at 02:43:00PM +0100, [email protected] 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 | [email protected] (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc I love long mails! | https://email.is-not-s.ms/ _______________________________________________ PyQt mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/pyqt
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE4E5WAAJAG47w528KkW6wyP1VoHIFAl3EIgEACgkQkW6wyP1V oHL3JA/8CMs0l3v2SLjcY+g1zaw2hKRArC9Vf+DCxBxWQkRIfx9Gx6bKMb+1/XME r9BvajBVpqYgw0Y142RB+9uSmYAzUvrmV1xVimpBefNlqTSj+uiHuIILWdGkdKOJ dpZTTucSqGz0lplhgJPVVd9INzDQi8A08mo5VafWQBtwUa6S/lUGDxuHa5MeT/aF 1N/osNd97nRRqZuNE+2D+5/AuFG5wMVkf4aLRkMPh1lxMHADiqhGWzMA4s1eujmx SdfvGp7GdU7+nYar2oql9GhKABgCnxw83N+uFgIVc7pK5uk5zA+uWzW2fu7z8ppz mbUAJMv20kzPjsZPRL/14qwKpRc51RYUwK7bJOhOX+LNRcGcRmtpew7wOavO/8+g qItm090ffbOH3RNVeTBcNBTC6EKzln0ylI5b0cLCu8B7NQI66QzkXOWV+vME+ka/ Ql4mFvrTz007c4gMt1qG0KWQ730GmBha70hm/FahN67Kg8Voobc0/7F7fUJLB5Ji 7sZdN7CrTCN2wtjS80OIzlceXOJhQWABCtt0XzVcaNoksrxJD9C076DbhO8Fb1Iq HThajh/Vu+mRqwRF7lBMp696ZcfUNMApwCETPIhiYqvUwOOhryD8FMHcg+Gl1EQR IYzDN1ooO3ohwceCe9VgkAbbx3u5pROJBAVV/X540T1HaIBrsTI= =cP5G -----END PGP SIGNATURE-----