| Reference | Downloads | Github

AttributeError: setColor

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 3.0.1
Standard Standalone? (y/n) Y
What are you trying to achieve?:
I am working on a modified stroop version. Just before the start of the stimuli, the subject has to keep a specific digit in memory and enter it again after each word of the stroop task.

What did you try to make it work?:
For this purpose I loaded the information about the colour of the stimuli into psychopy and saved them in a list. For a fully random colour (combined with the correct answer) I worked with two tutorials ( PsychoPy Scripting and Randomizing Stimulus Lists -- PsychoPy Tutorial #8 - YouTube & Using Code to Randomize Two Lists of Stimuli within a Single Loop -- PsychoPy Mini Tutorials - YouTube).

The stimulus list is looking like this:

What specifically went wrong when you tried that?:
The experiment is working, until the text object is trying to load in the colour. It’s somehow not working, but in a previous version there is no problem.

Here is the error:

    target.setColor(colour[colour_order[cur_colour]], colorSpace='rgb')

AttributeError: ‘list’ object has no attribute ‘setColor’

I used the print command, to see if the list is acutally filled with colours. This is working correct.

The error is still stopping the experiment if the colour is set to white.

Thank you all!


Is there a specific reason why you don’t simply do something like this?:



1 Like

Hi Jan,
Thank you for fast reply :slight_smile:
For my experiment it is necessary to randomize the stimuli completly and not only the rows of the excel file.
I somehow solved the problem by my own. The setting of the loop (fully random) crashed the experiment. If it is set to sequential it’s working.
Thank you very much :slight_smile:

I’m glad it works, but I’m not sure I follow. If you’d like to, feel free to explain in more detail: I’m not sure what you mean by “to randomise the stimuli completely and not only the rows of the Excel file”. Also, selecting “fully random” as the loopType certainly shouldn’t crash your experiment. If sequential is what you need (i.e., if the rows in your input file already are in the order you want your trials to be in), that’s of course what you should use, but I’m not sure how this aligns with what you’ve described above. Also, feel free to upload your solution (.psyexp and input file).