| Reference | Downloads | Github

PsychoPy encountered an unhandled internal error: unable to push changed on Pavlovia

I am unable to push changes I made to Pavlovia, for some reason. I checked my JS code components and they look fine. Any ideas on this will be much appreciated

Tell me about condition?

Are you possibly using it for more than one thing?

Thanks, I checked this - I don’t think so. I also renamed it to “variant” and still got the same error.
This is the JS code I use with it:

Set up the function in Before Experiment or format it as per my crib sheet.

I’d recommend using Auto code components and coding in Python.

Thanks, I used your crib sheet:

I need to create a variable condition which is a random number from 1 to 4. For some reason, I get the same error. It is specifically related to the code component and its routine. If I delete both, the experiment loads on Pavlovia without an error…

Your function has 1 and 5 instead of variable names such as min and maxplusone.

Thank you, I changed it now, but the same error occurs! It’s just so strange

I assume you got variant is not defined

No, I got the condition is not defined:


Define the function in Before Experiment

Define condition in Begin Experiment

If you try changing condition to variant, in needs to be changed in both locations.
I would recommend defining it in Python as well as JS.

I tried to do that - I changed everything to varient1. I also mentioned that I forgot the “;” in the line “condition = randint(1,4)”
I also now use A,B,C,D instead of 1,2,3,4
Before experiment tab looks like this:

Begin experiment tab:

This option worked here:

But for some reason I still get the same error that varient1 is not defined…