| Reference | Downloads | Github

Repeat Trials and Separating an Excel Sheet into 2 for Further Randomization

I push command+option+esc to get it to quit, which is the only way I know how, but it still does not save the csv file like it would if I ran the experiment all the way through.


⌘⌥ esc is the Mac operating system’s way of forcing an application to quit, in a highly uncivilised way. You should only use that for applications which have stopped responding to events (like not responding to ⌘Q, which is the Mac’s tidy way of quitting an application). The word “Force” in the “Force quit” button that pops up is a bit of an indication that this isn’t a regular way to get out of an application. So it’s not surprising you’re not getting any data saved, in the same way you wouldn’t if you literally pulled the plug on a computer power supply.

As stated, you need to let Builder know that you want to end the experiment so that it can do so gracefully, rather than just pulling the rug out from under it. The normal way to do this is with the escape key. That is enabled for you by default in the “Basic” tab of the experiment settings dialog you posted a screenshot of.

That is weird because I have tried using command+Q, esc, and really any other recommended combinations to get pyschopy to quit, and none of those worked on my laptop, which is why I finally found command+option+esc works for me.

OK, the goal here isn’t to get PsychoPy to quit. You just want to stop the experiment running. Your Builder script takes over handling the keyboard during the experiment so it swallows most keypresses, stopping most of them coming to the attention of the rest of the application (so ⌘Q probably won’t work anyway, although ⌘⌥ esc seems to get through to the operating system as it is a bit special).

So what you need to do is look at how PsychoPy is handling the keyboard:

  • Is 'escape' enabled in the experiment settings?
  • Is 'escape' in the list of allowed keys for any keyboard components?
  • Do you have any custom code that responds to the keyboard that might might be getting in the way of detecting 'escape'?

I applied those things, and now I can escape out of the experiment at the start during the instructions but could not when I tried to escape during one of the trials. Regardless, I am still getting no csv file when quitting.

Okay so now somehow I have gotten Cmd+Q to work, but only a log file is saving when I quit partway through with Cmd+Q.

Are you using PsychoPy version 1.85.6? It seems there was a bug like this affecting some users which was corrected in that version.

I am using 1.85.4

So you should upgrade to resolve this issue.

Hi Michael, could you help me with something again?

So I have decided to change the design of this same experiment, and I am now wanting to have the participants listen to a sentence (they’d see a big red dot on the screen while the sentence is playing) and then see a picture on the screen of either a goat or a coat, and they have to decide if that pictures matches the last word in the sentence they just heard or not (so each sentence they hear will either end with the word ‘goat’ or ‘coat’). Therefore, I want to be able to have the experiment randomize whether the goat or coat picture pops up on the screen after the sentence finishes playing for each trial. I cannot figure out how to do this, as this time the design calls for only one of the two pictures showing up in each trial, rather than having both pictures on the screen and just randomizing which side the picture shows up on each time. Can you help me? I’m using builder view.

Hopefully you can see that this is really the same thing, and be achieved by just slightly modifying the existing code. In this case, put two stimuli (one for goat and one for coat) in the same position, and instead modify their visibility:

visibility = [0, 1]


goat_stim.opacity = visibility[0] 
coat_stim.opacity = visibility[1] 

# store the result in the data: 
thisExp.addData('goat_visible', visibility[0]) 
thisExp.addData('coat_visible', visibility[1])