Hi,
I am having trouble piloting/running my experiment on Pavlovia. It runs smoothly in Builder, and I have uploaded the correct file to Pavlovia, but I’m receiving an error message before the experiment even starts saying that one of the parameters are not defined (please see attached screenshot). I have checked through my code in Builder, where the demo_face_two is defined, but I’m having problems running it online.
Can you please make your experiment public? I want to have a look at the full project because something odd happened here and I don’t know exactly what it is.
Broadly, the error is correct, in the javascript code, that variable is never defined. What I’m trying to figure out is how that happened. Typically, if it’s something that’s set in a loop, it’s set to “undefined” initially and then updated, but that’s not happening here for some reason, and how best to fix it.
It looks like that code component is in the “begin experiment” section of “face_demo” in python, but it was never converted to JS. So, make sure you’re using PsychoPy 2020.1.0 or later (the most recent is 2020.1.3), open that code component in the builder, and make sure code type is set to “auto->JS”, which should auto-convert that code component into javascript and include it in the javascript file. You should make sure all of your code components have been converted in that way, save and re-sync, and try the experiment again.
Thanks for the advice. I’m sorry to keep asking but I still can’t seem to solve the problem.
As you suggested, I downloaded the latest version of Psychopy, and set the code component as “auto->JS” for all my code components throughout the experiment. I saved, re-synced, and then tried to run the experiment and got the screen saying ‘initialising the
experiment’ (see attached). The ‘initialising’ message remained on screen for 30 minutes, after which I closed the tab.
I then deleted the original experiment off Pavlovia and (Re)created a project called Face reading 2. After syncing the experiment again, I tried to run it through Builder. I was able to put in my details at the beginning of the experiment (age, participant
ID, etc), but got the same original error saying demo_face_two not defined (see attached). Seeing this, I went back and made sure all my code components were set to “auto->JS” but am now getting the ‘initialising the experiment’ message again, without the
experiment ever running.
I was wondering if you could help me again? and I apologise for taking up so much of your time.
Ah, syntax error. In the “begin routine” code of the “practise_feedback” routine you have this line of code:
import * as csv from 'csv';
Unfortunately, import statements don’t work in auto->JS (this is a known limitation), and this library in particular exists in Python, but not in JavaScript. I see you are using it to create a separate CSV file to store some extra data. I’m don’t think it’s possible to do that in Pavlovia right now. You might have to settle for using currentLoop.addData() and adding it to the main data file as a new column.