Multiple keypresses required to end loop

OS: macOS 12.0.1
PsychoPy version (e.g. 1.84.x): 2021.2.3
Standard Standalone?: Y
What are you trying to achieve?:
I’m using the spacebar to end a looped routine. When it reaches the end of the routine, before it moves onto the next loop, I have to press spacebar four times to get to the next routine. In the next routine, I have to press spacebar twice to get to the third routine. What’s going on?

I’m including some screenshots of the excel files that contain the info for the loops as well as the flow below. I’ve cleared the contents of the spreadsheets below what I actually want to include (maybe there was something there?) but that didn’t work. It never changes and is consistent for four presses at the end of the first loop and two at the end of the second loop.

What code are you using to end the loops?

Just using a keyboard response that forces the end of routine, where the only allowed key is space. I honestly don’t know enough about Python to be able to read the exported script and know what to look for (happy to attach if it’ll help, though). It’s only for the first two loops (instructionLoops and gramLoop) that this occurs and those are also the only two places I’m using space to end the routine. I’m also not storing any input from those two loops, but am from the other two—could that be causing a problem?

If you want the spacebar to end the loop and not just the routine then you will need a code component.

For example, in End Routine

if key_resp:
     gramLoop.finished = True

assuming that the routine can end without a keyboard response.

The routine can’t end without a keyboard response, though, it’s a self-paced task.

Please could you upload your psyexp file?

Which routine requires four key presses and which requires two?

ImpExp3FixNC.psyexp (89.7 KB)

The first loop, instructionLoops, needs an additional four presses to end, and the second loop, gramLoop, needs an additional two presses to end.

I think the issue is with extra empty rows in your spreadsheets.

PsychoPy thinks InstLoop.xlsx has seven rows (not including the column titles) and NC3fixGramLoop.xlsx has four.

Okay, that makes sense. Any ideas on how to fix this (using a spreadsheet in a different format?)? When I create new spreadsheets, copy-paste only the relevant four rows and save again as xlsx, the same thing continues to happen. Same thing if I delete (e.g.) the three empty rows below the relevant rows.

Try deleting the excess rows and then reattaching the spreadsheet to the loop to see if you’ve been successful.

Do you have anything else in other columns or rows in the spreadsheet (other than the bits you need)?

That worked for InstLoop.xlsx, but after I do that in the NC3fixGram file, the last two entries in wugSing and wugPl (fasuku, fuskik) get repeated with the last line of instructions. I don’t have anything else in the files other than what I need/intend to show. When I separated the last line in the instructions, the one without anything in columns B-F and put it outside the loop, that fixed the problem in the NC3fixGram file as well.