# If obj.contains(mouse): AttributeError: 'str' object has no attribute 'contains'

**URL:** <https://discourse.psychopy.org/t/if-obj-contains-mouse-attributeerror-str-object-has-no-attribute-contains/42848>\
**Category:** Builder\
**Tags:** mouse, images\
**Created:** [November 6, 2024, 6:30pm UTC](https://discourse.psychopy.org/t/if-obj-contains-mouse-attributeerror-str-object-has-no-attribute-contains/42848 "2024-11-06T18:30:02Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [November 7, 2024, 8:07am UTC](https://discourse.psychopy.org/t/if-obj-contains-mouse-attributeerror-str-object-has-no-attribute-contains/42848/8 "2024-11-07T08:07:19Z")

</div>

The print statement was to investigate the error rather than fix it. However, if you are still getting an error related to “contains” when you have no reference to contains in your code then it must be the mouse component itself causing the error.

I know there was a bug in 2024.1.5 which meant it was worse (for me) than 2024.1.4 but I can’t remember what it was. Try setting the version to 2024.1.4 or removing the clickable stimuli and setting the mouse to end routine on any click to test. The latest version 2024.2.4 should be fine.

Are you trying to set a mouse correct answer (in the data tab of the mouse component). I know that can cause this error.

Here are a couple of other threads about this error.

> [@AttributeError: 'str' on clickable stimuli](https://discourse.psychopy.org/t/attributeerror-str-on-clickable-stimuli/25768):
>
> OS (e.g. Win10): Mac M1 PsychoPy version (e.g. 1.84.x): 2021.2.3 Standard Standalone? (y/n) If not then what?: What are you trying to achieve?:. I’m building an experiment where images pop on the screen one at a time and the response has to be made by mouse or touch. What did you try to make it work?: I have a condition file with - image column to present the images in spatial order and a valid column for reference of valid click. What specifically we…

> [@Mouse Response: Experiment exits on click](https://discourse.psychopy.org/t/mouse-response-experiment-exits-on-click/10908):
>
> I’m trying to build an experiment with a mouse response. There are two text fields that are automatically generated from the excel list. People hear a sound and have to click on one of the words. So far that works, but once I test the experiment and click on one of the words, it exits. I’ve tried pretty much all the settings there are for the mouse response, without success. This is the error message that I get: if obj.contains(mouse): AttributeError: 'str' object has no attribute 'contai…

---

_[View the full topic](https://discourse.psychopy.org/t/if-obj-contains-mouse-attributeerror-str-object-has-no-attribute-contains/42848)._
