Python to Javascript to use in Pavlovia

Hi all,
I have been trying to upload my experiment to pavlovia for the past weeks. Initially, I wasn’t able to create projects because of problems with psychopy v.2021.1.0. However, I am still unable to run my project from pavlovia because of problems with the translation from py to js. My task does run from psychopy.

URL of experiment: Andrea Mendez Colmenares / Sternberg Mar 2 · GitLab

One of the issues I have is with thisN loops, which do not work since I get an error that my loop is undefined. Along with other things that I have to manually modify to correctly translate the javascript.

Is there a way to work around this problem that does not imply manually going through my script and adapting the JS?

Thank you in advance,


Hi Andrea,

Most translation errors can be fixed through code components instead of editing the JS file itself (and that is what is recommended). In the case of replacing thisN, add a code component and instead make a custom trialCounter variable to use see the note on thisN in the crib sheet PsychoPy Python to Javascript crib sheet - Google Docs

Hope this is helpful,

1 Like