Keyboard allowed keys crashing program + not allowing .js creation

OS MacOS High Sierra 10.13.6
PsychoPy version: 2021.1.4
Standard Standalone? (y/n) yes
What are you trying to achieve?: I would like to use allowed keys in keyboard and store correct answers. I also would like to be able to save the program as a script/see it in coder view.

What did you try to make it work?:
I have made sure that all my psychopy versions are up to date, I have tried using older versions, I have tried using [] around the allowed keys as seen in other posts.

What specifically went wrong when you tried that?:

  1. On an older version like 2021.1.2 the program runs the routine, does not react to keyboard presses, and does not store any data from that routine.
    If i run on 2021.1.4 it entirely skips over any routine using keyboard tasks at all.

  2. Once I added allowed keys, the program would not save as a .js anymore. I have errors thrown up mentioning which line has a problem, but since I cannot save a new .js file anymore, I don’t know what those lines are. There is nothing to open in coder view since before I added allowed key. When I saved as new file, no .js could be created. When I open the .js file under the previous name in coder view, it simply does not show the routine with keyboard tasks at all. So in builder, these routines with keyboard tasks are in flow, in coder, these routines are not.
    My lastrun file is being updated, and included the code for the routines, but does not appear to list the all the keyboard information

No alerts or standout messages.

What is in the lastrun file:

Initialize components for Routine “BOTCHA1”

BOTCHA1Clock = core.Clock()
preBotch = visual.TextStim(win=win, name=‘preBotch’,
text=‘Before we start the study, please answer the following 2 questions that will determine whether you are eligible to continue. You will have 90 seconds to answer each item. If you do not answer within that minute, the item will be marked wrong. Please answer the items quickly and accurately to ensure you can continue on.’,
font=‘Open Sans’,
pos=(0, 0), height=0.035, wrapWidth=None, ori=0.0,
color=‘darklbue’, colorSpace=‘rgb’, opacity=None,
languageStyle=‘LTR’,
depth=0.0);
text_4 = visual.TextStim(win=win, name=‘text_4’,
text=‘Which of these digits is an odd number: 2, 6, 7, 8 ?’,
font=‘Open Sans’,
pos=(0, 0), height=0.035, wrapWidth=None, ori=0.0,
color=‘white’, colorSpace=‘rgb’, opacity=None,
languageStyle=‘LTR’,
depth=-1.0);
key_resp_3 = keyboard.Keyboard()

Initialize components for Routine “BOTCHA2”

BOTCHA2Clock = core.Clock()
text_5 = visual.TextStim(win=win, name=‘text_5’,
text=‘Please type the only letter in this list that is shown multiple times "KEY” “ONLY” “YAM”’,
font=‘Open Sans’,
pos=(0, 0), height=0.035, wrapWidth=None, ori=0.0,
color=‘white’, colorSpace=‘rgb’, opacity=None,
languageStyle=‘LTR’,
depth=0.0);
key_resp_8 = keyboard.Keyboard()

Thank you for taking the time to read my post!

I don’t think variables in allowed keys works online yet. You can do it in code by ignoring other keys or just include the full range of possible allowed keys in the component.

Thanks for your response!

  1. online - does that mean I can try to run it on the desktop version just not online, or not at all?

  2. Allowing full range- I have a task that allows the full range and it still is not functional, i.e. does not store correct nor end routine on keypress.

I think variable allowed keys are allowed locally.

Please could you show a screenshot of your routine and keyboard component?




Thank you!

I have not found a solution yet, I think that some other people are dealing with similar issues, though (Keyboard Response Internal Error).