Open JAbelP opened 4 years ago
Try devices.devices[0].name
.
I keep getting this error on MacOS Catalina
devices = laurel.laurel("username", "password") Traceback (most recent call last): File "", line 1, in File "/Users/shannonbrown/Desktop/lights/python-laurel/laurel/init.py", line 100, in init id = int(bulb['deviceID'][-3:]) TypeError: 'int' object is not subscriptable devices = laurel.laurel("username", "password") Traceback (most recent call last): File "", line 1, in File "/Users/shannonbrown/Desktop/lights/python-laurel/laurel/init.py", line 100, in init id = int(bulb['deviceID'][-3:]) TypeError: 'int' object is not subscriptable devices = laurel.laurel("username", "password") Traceback (most recent call last): File "", line 1, in File "/Users/shannonbrown/Desktop/lights/python-laurel/laurel/init.py", line 100, in init id = int(bulb['deviceID'][-3:]) TypeError: 'int' object is not subscriptable
I went in and changed this line in the laurel.__init__
from id = int(bulb['deviceID'])[-3:])
to id = int(bulb['deviceID'])
and it resolved the error. I dug some more and it seems that bulb['deviceID')
is already an int, explaining why you can't subscript it.
the code I have on my Rasberry pi 3 I am running it on python3 as bluepy would not install on python 2.7
import laurel
devices = laurel.laurel("myUserName","myPassword")
devices[0].set_power(False)
The error I get is Traceback (most recent call last): File"
devices[0]/set_power(False)
TyoeError: 'laurel' object is not subscriptable