OpenIAT modification not initialising - program is fine locally - not sure what to do next to debug

URL of experiment: https://pavlovia.org/run/TheSav/newharriet4/html/

Description of the problem: OpenIAT modification not initialising - program is fine locally

Hi All,

have been modifying the OpenIAT to work in a slightly different way. The code works fine locally but for some reason will not run online. Not sure what to post for info so please let me know what would help debug.

The online version never gets as far as the experiment settings window so I wonder if it cannot find the relevant stimulus files.

Have you checked that the Excel files have been copied to html/resources?

They weren’t, but they have been now and still it doesn’t work. :frowning:

It seems that the JavaScript files are missing in the html folder online.
To check that visit https://gitlab.pavlovia.org/, sign in and go to personal projects.
You also can upload the files (openIAT4.js and openIAT4-legacy-browser.js) manually into the html folder.

I also had some troubles with the synchronisation and started to upload things manually on gitlab.

Ah ok, well it seems it’s not generating any JS code. I’m getting the following error messages when I try to sync to pavlovia for the first time and I’m not sure what to do next…:

Generating PsychoJS script…

Traceback (most recent call last):
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 74, in generateScript
compileScript(infile=exp, version=None, outfile=filename)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 245, in compileScript
_makeTarget(thisExp, outfile, targetOutput)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 217, in _makeTarget
script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment_experiment.py”, line 247, in writeScript
self_copy.currentRoutine.writeEachFrameCodeJS(script, modular)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\routine.py”, line 321, in writeEachFrameCodeJS
comp.writeFrameCodeJS(buff)
File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\components\keyboard_init
.py", line 310, in writeFrameCodeJS
“Variables for allowKeys aren’t supported for JS yet”)
psychopy.experiment.utils.CodeGenerationException: Variables for allowKeys aren’t supported for JS yet:

To error you get is also described here:

You have to directly write your keylist in the allowed keys section instead of reading them from a condition file.

Ok, this is a problem.

I have set the program up so there are two keyboard response components (one for correct and one for incorrect). Each one gets the permitted response from the condition file. CorrectAns if correct, Feedbackkey if incorrect.

image

I did it this way to allow the program to put an ‘x’ on the screen if the wrong response is initially pressed, and then to wait for the correct response.

These permitted responses are trial dependent. Presumably I need to allow both responses (hard coded in the allowkeys) and then code to determine whether to feedback or not.

When I tried previously to do this in code the program kept moving to the next loop irrespective of how I did it and I couldn’t work out how to simply get the program to do the following:

  1. Permit either the A or L key.
  2. If the correct response (determined by the condition file) is pressed - move to next trial
  3. If the incorrect response (determined by the condition file) is pressed - put an ‘x’ on the screen and wait until the the correct response is pressed.
  4. The RT is determined when the correct response time is pressed.

Any help on the above would be much appreciated.

Ok so I’ve solved this by having a single key response component and not allowing it to end the routine.

I thne used this code in the frame component:

if len(key_resp.keys) > 0:
if key_resp.keys[len(key_resp.keys)-1] == InCorrAns:
msg=“X”
if key_resp.keys[len(key_resp.keys)-1] == CorrAns:
continueRoutine = False

1 Like

Quick update this code needed to be rectified - see here TypeError: Cannot read property 'length' of undefined