Error: The argument should be an array of numbers of length 3, colours defined in code component

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

PsychoPy version (e.g. 2024.2.4 Py 3.8):
**Standard Standalone Installation? Yes
URL = Change-Localisation-Task [PsychoPy]
Do you want it to also run locally? No.
What are you trying to achieve?:
I have a task that runs perfectly on builder but gives me the above error when I upload it to Pavlovia. The task is a change localisation task where 6 circles (each a different colour) appear on screen, briefly disappear then reappear. When the circles reappear, one of the circles will have changed to a different colour (e.g. a circle that was originally red when it first appeared is now blue). Participants indicate which circle changed colour by clicking with the mouse.

After reading previous pavlovia threads about the array length error, it seems related to the colours of the circles. However, the previous solutions don’t apply neatly to my scenario as they use a CSV file to list the colours of their stimuli, whereas I’m defining the colours entirely within a code component that exists in the same loop as my stimuli. See code example below:

#creating a list of possible colours for the circles using RGB values
colour_sequence = [(-1.0000,-1.0000,-1.0000), (1.0000,1.0000,1.0000), (-1.0000,-1.0000,1.0000), (1.0000,-1.0000,-1.0000), (-1.0000,1.0000,-1.0000), (1.0000,1.0000,-1.0000), (1.0000,0.0431,-1.0000), (1.0000,-1.0000,1.0000), (-1.0000,1.0000,1.0000)]
shuffle(colour_sequence) #shuffle list

#assigning the colours to a variable, which I will later use in the 'Fill colour' section of the polygon component.
circle_1_colour = colour_sequence.pop()
circle_2_colour = colour_sequence.pop()
circle_3_colour = colour_sequence.pop()
circle_4_colour = colour_sequence.pop()
circle_5_colour = colour_sequence.pop()
circle_6_colour = colour_sequence.pop()
target_circle_colour = colour_sequence.pop()


The screenshot is an example of how this fits into my stimuli

Would anyone know from my code why Pavlovia thinks my arrays don’t have a length of 3? My RGB values that i’m using for my polygon fill colours are in groups of 3… e.g (1.000, 1.000, 1.000) so I have no idea where the problem lies.

What did you try to make it work?:
I tried replacing the RGB code with actual colour names like what this thread suggested Error occuring: the argument should be an array of numbers of length 3 - Online experiments - PsychoPy

colour_sequence = ['magenta', 'cyan', 'red', 'white', 'black', 'blue', 'green', 'yellow']

Again, this worked in builder but still returned the same error in pavlovia. Which is crazy cuz at this point its not even a list of numbers. I tried setting colour space to hsv instead of rgb and got the same error.

I am at a loss. Any help would be much appreciated!

I’m not getting your error.

However, I am not seeing any circles, just a black 1 x 1 square outline. What is the start condition of your circles?

Hello

Like @wakecarter, I can only see a square outline.

Best wishes Jens

I am also getting the same problem, with the rectangle being almost the size of the browser window.

Also, I am not sure if colour names translate correctly from python to javascript (as referenced here:

PsychoPy Python to Javascript crib sheet 2021 - Google Docs page 17). The thread you cite also has this sheet referenced as well when using names of colours.

Maybe @wakecarter can clarify that?

Issac

Is your code component below your polygons?