I’ve tried syncing my experiment with a code component in python, but there was a problem with variables (refer to: Variable not defined pavlovia - #3 by mykolas_gudaitis), it synced, but didn’t work. I’ve corrected the code component and wrote the same code in JS so I could sync the experiment, like the following:
But now when I try to sync the experiment, psyhopy freezes and doesn’t even upload it to pavlovia. There are some .mp3 and .png files in the experiment if this helps
I’m quite sure the JS has a syntax error. If you copy-paste the code I can make a suggestion on how to fix it. Still, I wouldn’t expect that to make the Builder freeze though. If you disable this code component, does exporting work again?
I’ve tried disabling it, but still the same issue remains:
This table pops up and then freezes. The JS code I’m using:
randDuration = function(1.000, 2.001) {
return Math.floor(Math.random() * (2.001 - 1.000) ) + 1.000;
}
Looking at the Python, I guess that this is what you are after:
randDuration = Math.floor(Math.random() * (2.001 - 1.000) ) + 1.000;
About the freezing: how about exporting to HTML (without syncing)? Are you using the latest version of PychoPy (2021.1.2)?
I corrected the JS code, but exporting to HTML still doesn’t work, the result is about the same:
I’m using the latest Psychopy version (2021.1.2)
Not sure what is going on then, but it seems an issue on the builder side of things. I recategorized your post so that people with the right expertise are alerted.
1 Like
I downgraded psychopy to 2020.2.4 version and the experiment synced successfully
Look closely at this formula
randDuration = Math.floor(Math.random() * (2.001 - 1.000) ) + 1.000;
randDuration = Math.floor(Math.random() * (1.001) ) + 1.000;
randDuration = Math.floor(number between 0 and 1.001) + 1.000;
randDuration = 0 + 1.000;
randDuration = 1; (in 1000 out of 1001 cases or thereabouts)