Experiment stuck initialising import random

URL of experiment: https://pavlovia.org/LeaRahel/consolidatietrial

Description of the problem:
We want to run a study (made with PsychoPy builder) online, via Pavlovia. However, the experiment is stuck initializing. I found out that the error occurs in line 101 of the javascript syntax, which is: import * as random from ‘random’. I have read that one cannot import from numpy or pandas. As random is from numpy, I am wondering whether this is the problem, and whether it is just not possible to run the study online, or whether there is an option to fix that problem?
I would be thankful for any tip!
Best,
Lea

Hi Lea,

Have a look at my crib sheet (see pinned post)

Hi wakecarter,
Thanks for your reply! I already had a look at the crib sheet, and I saw that (under don’ts) it says that I cannot use numpy and panda or import, and for do’s you recommend to Remove all references to avoid the experiment crashing while “initialising the experiment”. I’m afraid I do not really understand what you mean by that?

You don’t need to import random to use random functions in PsychoPy. Maybe search for the crib sheet for the word random.

Thanks again! Yes, I did that too, so if I understand it correctly, I can just use Math.random() instead of random() whenever I use this function, without importing.

I’m pretty sure you can just use random() if you’ve specified random=Math.random in code_JS

Okay, I will try further! Thanks for your help.