Keyboard Response Internal Error


While uploading to Pavlovia, currently receiving internal error message to share with dev’s.

This seems to be related to the conditional keyboard responses that are part of my conditions file depending on the block of trials a participant is in. When I simply set Allowed Keys to be a list of letters directly in the keyboard component in builder, the error goes away.

Traceback (most recent call last):
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\", line 1240, in onPavloviaRun
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\", line 719, in fileExport
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\", line 73, in generateScript
    compileScript(infile=exp, version=None, outfile=filename)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\", line 242, in compileScript
    _makeTarget(thisExp, outfile, targetOutput)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\", line 214, in _makeTarget
    script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\", line 260, in writeScript
    self_copy._currentRoutine.writeEachFrameCodeJS(script, modular)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\", line 340, in writeEachFrameCodeJS
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\components\keyboard\", 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: 
1 Like

Hi mjharris,
I don’t have a solution but experience the same problem.
Have you found a solution yet?
Currently, I’m thinking about reprogramming the stuff, so that I avoid using variables for the Allowed Keys component. Because that is the recommendation in other posts, which I have found so far (Undefined error message when running study online 2.0 - #6 by lnnrtwttkhn)

If your keyboard component doesn’t end your routine then there is no need to worry about allowed keys.

If it does, then you could switch to ending your routine in code where you could vary the key being monitored.

Some of them end my routine.
But from I’ve read so far, I’m rather facing the issue, that JS cannot work with undefined Allowed Keys. Is that correct?
Because if so then I think I have to define the keys directly, not by code.

I’m pretty sure you can leave the allowed keys blank (to allow all keys).

Ah, sorry, I haven’t made myself clear! I wanted to define the keys depending on the current task. So that’s why I tried to define them by code. Works offline, but I can’t upload it to Pavlovia.
I found posts saying that JS needs the keys to be defined beforehand, not on a trial-by-trial basis.

I have a similar problem, Keyboard allowed keys crashing program + not allowing .js creation - #4 by wakecarter , and would also like to figure it out!
Mine doesn’t work offline either though - how did you achieve that?