| Reference | Downloads | Github

Hitting escape key freezes PsychoPy

If this template helps then use it. If not then just delete and start from scratch.

OS OS X 10.8.5):
PsychoPy version (1.84.1):
**Standard Standalone? (y)

I upgraded to 1.84.1 to test it out and find that several of my scripts freeze my computer when I hit the escape key. I realize this is a very vague report - I have to do a hard shut-down of my computer whenever this happens (it’s an irregular but common problem), so I don’t get an error message. I haven’t been able to figure out what the scripts have in common that might be causing it, so this is little to go on, but I still thought I should report it.

I suspect that this is related to pyo not shutting down properly, this is a known issue. The escape key by itself does not really do anything except tell PsychoPy to stop. Try updating pyo if possible.

Can you run a script in non-full-screen mode, and force-quit it (using the red stop button from Builder, or Force-quit via OSX?

Hi Jeremy,
Yes, if I run in non-full-screen, I can use the red button to stop it, so presumably this is the Pyo issue you’ve suggested.

Hi Mark, Jeremy, and the PsychoPy community,

I seem to be having a similar issue. The Escape key doesn’t work for me either.

Sadly, even if I am not running in the Full-Screen mode, attempting to close using the red button doesn’t stop the experiment for me. Instead, the application becomes non-responsive, and I have to ‘Force Quit’ it.

I am running PsychoPy 2 (v1.85.1) on OS X (10.12.4).

I am not sure I understand what “updating pyo” means or entails. Is “pyo” an acronym for something? A Google search led me here ( and I installed the latest version and restarted the application. However, that didn’t seem to make a difference, so I am not sure if I correctly did what you explained in the solution.

Could you please point me to the right direction? Thanks in advance for the help!

We are running Psychopy 1.84.2 on Windows7. Pressing the escape key causes core.quit() to freeze. Installing a newer version of pyo didn’t help. Our solution is in the order of the imports. Psychopy Builder generates this:

from future import division # so that 1/3=0.333 instead of 1/3=0
from psychopy import locale_setup, visual, core, data, event, logging, sound, gui

When we compile the script and go to Coder View, we can change the import statements to this:

from future import division # so that 1/3=0.333 instead of 1/3=0
from psychopy import sound
from psychopy import locale_setup, visual, core, data, event, logging, gui

and the problem is solved.

@jon: can you change the Psychopy Builder script compiler so that it imports the sound module earlier? It might be a good idea to also import the visual module earlier.


Interesting Hubert. I can certainly fix that if it makes a difference. Fingers crossed it doesn’t have any other knock-on effects I guess! :slight_smile:

I have this problem too (psychoPy crashes upon pressing Esc, instead of just exiting), and this problem persists if I remove ‘pyo’ from Preferences|General|AudioLibrary. Someone earlier says updating pyo doesn’t help, so do I understand correctly that the problem will be fixed at the next PsychoPy version?

Following Hubert’s suggestion, I’ve reordered the import of sound lib to come earlier (that’s in the new 1.85.2 release available now)

I’ve also updated the version of pyo (at least in the OS X standalone).

I don’t know. Either of the two fixes above could help except that, if you say pyo wasn’t the problem in your case then it probably won’t make any difference for you!

What is strange is that, although ‘pyo’ was removed from the libraries list as explained, and although ‘pyo’ doesn’t even appear in the script’s code, the PsychoPy output still displays this after every execution:

“pyo version 0.6.6 (uses single precision)”