| Reference | Downloads | Github

Image stimuli object is not iterable

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): macOS Big Sur 11.2.3
PsychoPy version (e.g. 1.84.x): v2021.1.3
Standard Standalone? (y/n) If not then what?: Yes
What are you trying to achieve?:
I have images and text that I’ve made clickable objects so that when they are clicked the routine ends and the experiments advances. This was working fine a couple of weeks ago, but now it crashes and says “object is not iterable”. This happens with both images and text that I’ve made clickable.

What did you try to make it work?:
Disabling the components makes it work, but obviously not the goal…It also works online just fine, it’s only a local problem.

What specifically went wrong when you tried that?:
Experiment crashes with the following error:
‘[object name]’ object is not iterable.

Happens on any routine that has a clickable stimuli.

Include pasted full error message if possible. “That didn’t work” is not enough information.

Are you using code to make the objects clickable? If so please show your code. If a component, please show a screenshot of the code component.

No, there’s no code on this first routine (although the error happens in every routine with a clickable stim). Here is the code (line 574 is where the errors shows up). Thanks for the quick response!

Screen Shot 2021-03-19 at 10.51.04 AM

Is that the new Button component?

I’m not sure that’s working online yet.

No, it’s just an Image stim I called “NextButton”. Is it possible this has something to do with this fix in the latest PsychoPy version?

  • Builder: Fix 'list' object has no attribute 'contains' with clickable mouse objects #3651

Any further thoughts on this issue @wakecarter ? Thank you!

Try putting NextButton in quotes to show it’s the name of a component, not a list.

Or try putting square brackets round it.

Or both

Hello, @wakecarter

I have a similar problem.

Putting square brackets round the OBJECT NAME seems to work on Psychopy Builder, but not on the web (i.e., an error “TypeError: obj.contains is not a function” occurs). On the other hand, not putting square brackets seems to work on the web but not Psychopy Builder (i.e., an error “‘[object name]’ object is not iterable” occurs).

Would you please give me any suggestion?

Are you using a 2021 version? Try adding a comma after the name of the image component, but don’t put it in quotes.

I believe updating to the newest version of Psychopy solves this problem. Seems similar to this problem.

Thank you for your suggestion and I am sorry for not telling you my circumstance, @wakecarter

I am using psychopy ver 2021.1.4 on Mac OS Big Sur and adding comma makes everything OK.

Thank you again.