Initializing the experiment

URL of experiment: pilot link: https://run.pavlovia.org/michele_conni/texture_stationarity/html/
code: https://gitlab.pavlovia.org/michele_conni/texture_stationarity

Description of the problem: I know it’s a common problem, but I haven’t managed to solve it nonetheless: I uploaded my PsychoPy experiment to Pavlovia, and when I try to run the pilot I only get a blank screen with ‘initializing the experiment…’ written inside. The experiment works offline.
I set up my experiment with the Builder, but I also used some Python code blocks. I am quite used to programming in Python, but I’ve never programmed in JS, HTTP and CSS, thus I don’t have the least idea on how to deal with the problem, if, as I understood from the answers to similar problems, there is something wrong with my JS file. Am I using some wrong import? If it’s needed, how do I debug my JS code?
I am using Firefox and PsychoPy v2020.1.3 (which runs on Python 3.6.6).

Thank you

@michele_conni, the issue is that your python imports have been translated over to JS e.g.,

import * as random from 'random';
import * as xlrd from 'xlrd';

Python libs cannot be imported in JS, and also you cannot use import statements in the main body of JS at runtime (unless you use dynamic imports). I think the second point is being addressed, allowing users to insert import statements at the beginning of the JS code, but for now you will need to edit the code components (set code type to “Both”) to remove the imports, and then also find JS compatible methods for taking over those jobs, e.g., you can use Math.random() for randomising, or util.shuffle(array) for shuffling arrays in place.

@dvbridges thank you! Just for clarification, the difference, in ‘Code Type’, between ‘Both’ and ‘Auto->JS’, is that in the first one you can edit the JS code without modifying the Python part, while in the second the translation is automatic? And the offline code works directly with Python, right? Thanks again!

I think I solved the problem with the JS code, but now I’m stuck with the following error: immagine
I took a look at all the code,but I couldn’t find the this._trialSequence[this.thisRepN] line anywhere. From Running experiment online: TypeError: this._renderer.gl is undefined I could understand that it could still be a problem with the code, but I couldn’t trace back to the source… Do you have any suggestion?