| Reference | Downloads | Github

Psychopy/visual and pynput conflict on specific MacOS versions

2009 Mac Pro/OSX El Capitan, 2015 Macbook Pro/OSX Catalina, 2010 MacPro/OSX El Capitan
Anaconda installed Psychopy (python v 3.6.6)

I don’t have this error on my 2017 Macbook Pro/OSX Mojave, either using standalone or anaconda psychopy

I’m trying to run a code called “” that can be downloaded from this site. It is used to communicate with a response box that is connected with USB.

It gives me the following error:

Traceback (most recent call last):
File "/Users/user/Downloads/RTBox_python_000/", line 15, in <module>
    import RTBox
File "/Users/user/Downloads/RTBox_python_000/", line 14, in <module>
    from pynput import keyboard
File "/Users/user/anaconda3/envs/psypy3/lib/python3.6/site-packages/pynput/", line 40, in <module>
    from . import keyboard
File "/Users/user/anaconda3/envs/psypy3/lib/python3.6/site-packages/pynput/keyboard/", line 40, in <module>
    from ._darwin import KeyCode, Key, Controller, Listener
File "/Users/user/anaconda3/envs/psypy3/lib/python3.6/site-packages/pynput/keyboard/", line 144, in <module>
    class Listener(ListenerMixin, _base.Listener):
File "/Users/user/anaconda3/envs/psypy3/lib/python3.6/site-packages/pynput/keyboard/", line 148, in Listener
    Quartz.CGEventMaskBit(Quartz.kCGEventKeyUp) |
File "/Users/user/anaconda3/envs/psypy3/lib/python3.6/site-packages/objc/", line 181, in __getattr__
    raise AttributeError(name)
AttributeError: CGEventMaskBit

The error seems to originate from “” first stating:

from psychopy import visual, event, core

And then states:

import RTBox

In which the line from pynput import keyboard consequently prompts the error.

If I remove visual from the first line, from pynput import keyboard does not give an error, but I obviously get other errors further down the script. If I import visual after I import RTBox , The script gets stuck at presenting the subject instruction screen (the first screen presented).

Any ideas how to solve this?