Vision sensor coding error

We are using the vision sensor and the code is coming up with this error:

traceback (most recent call last)

File “userpy”, line 142,

im win_sta

type error:object isn’t subscriptable

suggestions? solutions?

Hi
When you are asking about coding questions, please post your code in code tags.

However, based on your error, I would assume you should go to line 142 and look at every object you are indexing. Look at every variable that is followed by a objectThingey.something or objectThingey[someStuff]. Before line 142, place some print objects to make sure that these variables you are indexing into are actually the same type of object you think they are.

This is all the code we are using. There is no line 142.

You need to check that there are objects (object count > 0) before trying to access an object, otherwise you probably get that error. An unfortunate side effect of the internal switch to blocks generating Python rather than C++.

2 Likes

Actually, use the “object exists” block, that will work a little better.

2 Likes