psychopy.org | Reference | Downloads | Github

Absolutely cannot figure out bug: When converting an object to its numerical form - unable to convert undefined to a number (Minimal Pavlovia experiment)

URL of experiment: minimal [PsychoPy]

Code for the experiment: tlab / MinimalSliderTest · GitLab

Description of the problem:
Whenever I try to run the experiment, I receive the error message

when converting an object to its numerical form
unable to convert undefined to a number
Try to run the experiment again. If the error persists, contact the experiment designer.

I’ve tried ensuring no variables anywhere are left undefined, paring back the experiment to its minimal components, everything I can think of to get it to work in some minimal version, but I still see the bug each time.
I think it might have something to do with the sliders? That being said, I’ve disabled collecting any data from them and I still see the bug.

For what it’s worth, the experiment works just fine in its Python version locally on my computer.

I’ve seen two previous versions of this issue here and here, but their problems don’t seem to apply here.

I think the issue is with this bit of code in your code component:

    circle_fill = [0, green_val, 0];
    Circle_G.setColor(circle_fill, {"colorSpace": "rgb255"});
    Circle_R.setColor([1, 0, 0], {"colorSpace": "rgb1"});
    Circle_G.size = [size_val, size_val];
    Circle_R.size = [size_val, size_val];
    green_val = 10;
    size_val = 0.3;

You need to define green_val before you use it as a green value in your circle fill color. Currently its being passed as undefined.

facepalm

Yes, that’s fixed it. Thanks for your help!