Issue with assigning colorSpaces with latest PsychoPy update

Hi all,

I am trying to assign a color space to my ImageStim from a list of colors.
I have recently updated to the latest version of PsychoPy, and now I am not able to assign my color space. It worked in the previous version, is there a way around this at all?


We did change how colorSpaces are handled in the newest version, but I’ll need more information to be able to help. What kind of stimulus was it, what were you changing the colorSpace from/to, and what errors are you getting?

I am trying to display an ImageStim. My code was as follows:

stimulus1 = visual.ImageStim(win, image = shapeValues)
stimulus1.colorSpace = 'colorValues'
stimulus1.color = colorValues[0] in colorTrials
stimulus1.size = 0.3
stimulus1.pos = stim1POS

Where ‘colorValues’ is an array of predefined RGB colors, which are later calculated in a CIELa*b color space.

The error that I am getting is:
Files\PsychoPy3\lib\site-packages\psychopy\visual\", line 452, in colorSpace
if value in colorSpaces:
TypeError: unhashable type: ‘list’

Thanks in advance for looking into it!

Ah okay, I think you’re confusing colorSpace with setting a color pallette - colorSpace should just be the name of the mathematical space you’re defining colors in (e.g. ‘rgb’, ‘hex’, ‘hsv’). What you’ll need to do is set colorSpace to 'rgb' (assuming these are RGB from -1 to 1? If it’s from 0 to 1 then use 'rgb1' and if it’s from 0 to 255 use 'rgb255') and then apply the pallette to the image’s texture before assigning it to the ImageStim