psychopy.org | Reference | Downloads | Github

"Unknown named color" stops experiment running... [PARTIALLY SOLVED]

URL of experiment: https://pavlovia.org/YouriLMora/a1_test

Description of the problem:
Hi,
I designed an experiment on Psychopi v.1.90.1, that works fine under PsychoPy v3.0.6.

However, when I upload it on pavlovia.org, it doesn’t run and display the following error message : “Unknown named color”.

Have you already observed this kind of compatibility problem ?
I used rgb colors as well as web/X11 color names.

Thanks,

Youri

Hi @YouriLMora, looking at the JS code, the fill color for your shape polygon_6 has an empty string for the color, which will not work. What have you put as the fillColor for that shape?

Thank you for your answer.

The field was left blank at the time, which worked fine running the experiment under the Builder (not on pavlovia however).

After browsing the forum, I changed the blank space to “$None”, but a message error stated that None was undefined.
Following How to make the fill color of a ShapeStim transparent I also tried “None”


I thought this was it, but I get the following error message :

As a pragmatic and temporary solution, I set the same color for the stimuli and the background, that makes it look like it is transparent.

Great. Looks like this is fixed in the most recent version 3.1.2, where blank fillColor is compiled as “undefined” in JS, which works fine. I think having the fill color the same as the window color is just as good :slight_smile:

Hello,
Progressing further in making the experiment compatible with pavlovia, I got a similar problem that apparently requires a modern solution :

image

The error message appears at the beginning of a routine (“train_MasculinFeminin”).

I have looked up the code thoroughly and I could not see what this ‘o’ color was referring to. I checked the colors from the external lists that I am using, and they all seem correct (“royalblue” or “forestgreen”). If you have insights on this one…

I tried again today and the message error is not always identical. The stated unknown named color can be “i”, “o”, or “è”. But most of the time it is “o”. I am clueless really

Thanks again !

up ? :slight_smile:

I just tried to run the task but received a ReferenceError msg not defined - this would mean that you need to define msg in your code component in the JS window. Open your code component, select “both” as a code type, and translate your python code from the left panel into JavaScript code in the right panel.

This error re: color is probably from the line
motsMascFem_2.setColor(new util.Color(Couleur));

This is a text stim, where you are setting the color on every routine using the Couleur variable, which should be defined in your conditions file called MascFem.xlsx. This should be ok, but it looks like something odd is going on with how the trial handler is parsing your conditions file. I will try to recreate the error using a smaller task, and see what is happening.

@YouriLMora, the issue lies with how rows are selected in your trialHandler. If you did not select specific rows, the task will run. The error happens when you try to use a sequence to define your selected rows. Currently working on a fix to get the selected rows working correctly.

Hi @dvbridges,
Thanks a lot for this piece of advice, that was it. I translated the Py code into a JS code and it seems to work, as you can see here https://run.pavlovia.org/YouriLMora/iat_a1_test/html/ (to skip the instructions, you can press Enter).

Here is the Py Code

if resp_MascFem_2.keys: # ie if the list isn't empty:
    if resp_MascFem_2.keys[-1] != Reponse: # check the latest response
        msg="X"
    elif resp_MascFem_2.keys[-1] == Reponse: # check the latest response
        msg=" "
        if len(resp_MascFem_2.rt)>1:
            resp_MascFem_2.rt[-1]==resp_MascFem_2.rt[-1]+resp_MascFem_2.rt[-2]

Here is the JS Code

if (resp_MascFem_2.keys.length > 0) { 
    if (resp_MascFem_2.keys[resp_MascFem_2.keys.length - 1] !== Reponse) { 
        msg = "X"; } 
    else if (resp_MascFem_2.keys[resp_MascFem_2.keys.length - 1] === Reponse) { 
        msg = " "; 
        if (resp_MascFem_2.rt.length > 1) {
            resp_MascFem_2.rt[resp_MascFem_2.rt.length - 1] === resp_MascFem_2.rt[resp_MascFem_2.rt.length - 1] + resp_MascFem_2.rt[resp_MascFem_2.rt.length - 2]; } 
        continueRoutine = false; } }

@YouriLMora, the issue lies with how rows are selected in your trialHandler. If you did not select specific rows, the task will run. The error happens when you try to use a sequence to define your selected rows. Currently working on a fix to get the selected rows working correctly.

As a pragmatic solution, I created new external lists involving only the previously the selected rows. However, I believe there should be a more elegant solution. I would be happy to hear about it if you find it.