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

Hi everyone,

I’m reaching out for help with an issue I’m having in PsychoPy.

OS Win10
PsychoPy version 2024.2.4 Py 3.8
Standard Standalone Installation? Yes
Do you want it to also run online? Yes
What are you trying to achieve? I am setting up a 4AFC acoustic perception experiment. Choices must be selected by clicking on text according to the audio stimuli perceived.

What did you try to make it work?: I configured clickable stimuli as follows, but when I run the experiment and make a choice, it stops and get the error described in the topic.

What specifically went wrong when you tried that?:

Traceback (most recent call last):
File “C:\Users\acost\Documents\Psychopy\Prueba1_lastrun.py”, line 799, in
run(
File “C:\Users\acost\Documents\Psychopy\Prueba1_lastrun.py”, line 662, in run
if obj.contains(mouse_resp):
AttributeError: ‘str’ object has no attribute ‘contains’
2.7207 WARNING Monitor specification not found. Creating a temporary one…
ioHub Server Process Completed With Code: 0
################ Experiment ended with exit code 1 [pid:17452] #################

Thanks in advance for your time and help. I’m just starting out and would really appreciate any guidance!

Best regards.

Do you have any fields in your conditions file which have the same name as any of your stimuli? If so, those stimuli names will be overwritten by the value of those fields each trial, so when other Components try to interact with them by name (as the Keyboard Component does) it gets the value from the conditions file rather than your Component.

1 Like

Dear Todd:

Thank you very much for your reply! These are the field names of my conditions file:

Do you think the column names op1, op2, op3 and op4 might be interfering with the names of the text stimuli in the routine?

Best regards.

Hmm, they shouldn’t be - as they are different to the variable names. Could you share the psyexp file?

1 Like

Dear Todd:

Sorry for the late response, I was away. This is the psyexp file:

Prueba1.psyexp (20.9 KB)

Thank you very much for your help.

Regards.

Hi everyone,

Could someone please help me? I’m stuck and can’t make any progress with the design of my experiment. I’d really appreciate your support!

I wonder if there is some issue with _t. Try changing the text names to op1_text etc and make the same change in mouse_resp