Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: list indices must be integers or slices, not str #210

Open
Nickduino opened this issue Dec 23, 2023 · 4 comments
Open

TypeError: list indices must be integers or slices, not str #210

Nickduino opened this issue Dec 23, 2023 · 4 comments

Comments

@Nickduino
Copy link

I'm just trying to get the state of a light (light 1 does exist, "print(lights[1].name)" returns a name)

image

image

@Nickduino
Copy link
Author

Seems identical to #107

@Nickduino
Copy link
Author

Nickduino commented Dec 23, 2023

I made a mistake

lights[1].name returned "Lit", so I thought light 1 was "Lit"

But it was [1] and not (1), meaning it was light #1 of the list lights and not light number 1

So, in the examples, instead of :
Get the name of light 1
lights[1].name

Maybe you could propose:
Get the name of light 1,
b.get_light(1,'name'))

OR

Get the name of light [1] of lights
lights[1].name

@Nickduino
Copy link
Author

Also, when a light is unreachable, maybe you could return the error ([{'error': {'description': 'resource, /lights/1, not available', 'type': 3, 'address': '/lights/1'}}]) as a string, so that we can print it?

@Nickduino
Copy link
Author

I consider my issue solved but I leave it open to give @studioimaginaire a chance to check it out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant