psychopy.org | Reference | Downloads | Github

Undefined parameters in Pavlovia

URL of experiment:

https://run.pavlovia.org/sabasiddique/face-reading-project/html

Description of the problem:

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.

I was wondering if anyone could help me?

Thanks,
saba

Screen Shot 2020-03-21 at 8.54.29 pm

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.

Hello,

Thanks for your reply. I have set the experiment to “Running”. Does that make it public?

Thank you,

Saba

No, click on “View Code”, then on the left of that screen click “Settings”, then “General”, then “Permissions”, set to “public”.

If you post a link to the repository when you do this, that will also speed things up.

Sorry about that - I’ve made it public now.

I’m not sure if this is the correct link to the repository you are asking for, but this is the url to Repository tab on the left of the screen when I open up my project gitlab: https://gitlab.pavlovia.org/sabasiddique/face-reading-project/tree/master

Files · master · Saba Siddique / Face Reading Project

Sign In/Register

Please let me know if this is incorrect, or if you require more information.

Thanks so much for your help,

Saba

This is exactly what I was looking for. From lines 339-353 of your python file (https://gitlab.pavlovia.org/sabasiddique/face-reading-project/blob/master/MY%20TRUST%20GAME%201.6_lastrun.py) there’s this conditional statement that sets a value for demo_face_two and the like. It looks like that’s a custom code component. That is completely missing from the javascript file (https://gitlab.pavlovia.org/sabasiddique/face-reading-project/blob/master/html/MY%20TRUST%20GAME%201.6.js), which definitely explains why the variable isn’t defined.

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.

Hi,

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.

Thanks,

Saba

Screen Shot 2020-03-21 at 8.54.29 pm.png

Sorry, Just adding the URL for the new version I’ve uploaded to Pavlovia: https://pavlovia.org/run/sabasiddique/face-reading-1-2/html/ and
letting you know that I have made this version ‘public’ too.

Kind regards,

Saba

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.