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

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

OS (e.g. Win10): Windows10
PsychoPy version (e.g. 1.84.x): v2021.1.3
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:


I have an experiment that has the following routine:

It is part of a loop that has the following file:

All the cells from the Excel file are defined as text (tried defining them as General, but still received errors):

When I reach this routine, I receive this error message:
AttributeError: ‘str’ object has no attribute ‘setText’

What did you try to make it work?:
I tried renaming the Excel file, the text component, the column name, formatting the cells as Text and General.

Note: I have another file with the exact same routines that does not produce this error.

Do you have any idea on why this happens? I tried looking everywhere and couldn’t find anything.

Is it possible that you have two spreadsheets with the same column name?
See the following:


No, I don’t have 2 spreasheets with the same name.

I had seen that topic too → but I only have one spreadsheet in the entire experiment that is named “practice.xlsx”.

In addition, I tried renaming both the actual spreadsheet and the column name multiple times and I receive the same error message, regardless of what names I put.

I see.
Any chance you could share the experiment?
Also, why is your start time set to condition instead of time (s)?


The error message suggests that you are using the name of the component (prac2_letter) in a code component at some point, and setting it as a text variable.