psychopy.org | Reference | Downloads | Github

AttributeError: 'list' object has no attribute 'contains'

OS: macOS Big Sur (v 11.2.3)

PsychoPy version: 2021.1.2

Standard Standalone? (y/n) y

What are you trying to achieve?:
Run Posner experiment from YouTube demo.

What did you try to make it work?:
Followed all of the instructions. It works on Pavlovia, but not locally. It seems like python is treating the target image (target) as a list instead of an image object.

What specifically went wrong when you tried that?:
First cue will appear followed by first target. Upon clicking the target, the experiment is terminated.

Full error message:
17518.4618 INFO Loaded monitor calibration from [‘2021_04_05 10:24’]
0.3177 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
2021-04-07 13:19:05.705 python[2429:189690] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/83/fdz0k43544b8rpj_434m_38h0000gn/T/org.opensciencetools.psychopy.savedState
Traceback (most recent call last):
File “/Users/emilywong/Desktop/Psych 121_S21/Week 4/posnerfirst/posner_lastrun.py”, line 433, in
if obj.contains(resp):
AttributeError: ‘list’ object has no attribute ‘contains’

Experiment ended.

Thanks so much!

Add a comma after target. I learnt that one at today’s workshop. Thanks @Becca

Thanks for your reply! But that didn’t seem to work, getting the same error. This is what I have:

That looks right. I saw it working today in 2021.1.3

Maybe try deleting target altogether to test

Ahh I see! 2021.1.3 specifically addresses this issue:

Thanks, @wakecarter :slight_smile:

1 Like