Name error: name 'event' is not defined

OS (e.g. Win10): Mac OS 10.15.4
PsychoPy version (e.g. 1.84.x): v2020 1.2
*Standard Standalone? (y/n) y
What are you trying to achieve?:

Experiments no longer work after update.
They produce the following error

  File "/Users/marcbuehner/Dropbox/FAPESP_TimePerception/Reproduction/Reproduction_MB_lastrun.py", line 295, in <module>
    if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/hardware/keyboard.py", line 221, in getKeys
    name = event.getKeys(keyList, modifiers=False, timeStamped=False)
NameError: name 'event' is not defined
##### Experiment ended. #####

I cannot work out why it does that – is it some backwards incompatibility issue?

THanks
Marc

Hi Marc,

To fix this issue, you need to go to your System Preferences > Security & Privacy > Input Monitoring and allow PsychoPy3.

Hope this helps :slight_smile:

Thasya

3 Likes

The key is, you can’t use the “Quit and Relaunch” option when selecting PsychoPy3 in Input Monitoring. Since PsychoPy is buggy on MacOS, you need to select “Later”, then manually quit PsychoPy3, manually relaunch it, then click on the icon in the dock so that it opens the full application.

Is there a fix for this for Windows computers? I am setting up 10 laptops for testing, I have several different laptops, most of them the experiment runs fine, 2 of them I get the nameerror: name ‘event’ is not defined error.