Keyboard Response Internal Error

Win10
v2020.2.10

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\builder.py", line 1240, in onPavloviaRun
    self.fileExport(htmlPath=self._getHtmlPath(self.filename))
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py", line 719, in fileExport
    target="PsychoJS")
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py", line 73, in generateScript
    compileScript(infile=exp, version=None, outfile=filename)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py", line 242, in compileScript
    _makeTarget(thisExp, outfile, targetOutput)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py", line 214, in _makeTarget
    script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\_experiment.py", line 260, in writeScript
    self_copy._currentRoutine.writeEachFrameCodeJS(script, modular)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\routine.py", line 340, 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: 
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)
Cheers!

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?