# Keyboard psychtoolbox/hid failing with Mac OS Catalina update

**URL:** <https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389>\
**Category:** Builder\
**Created:** [October 13, 2019, 6:36pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389 "2019-10-13T18:36:27Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fiona\_Zhu](https://avatars.discourse-cdn.com/v4/letter/f/3ab097/32.png) [@Fiona\_Zhu](https://discourse.psychopy.org/u/Fiona_Zhu)\
**Post date:** [October 13, 2019, 6:36pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/1 "2019-10-13T18:36:27Z")

</div>

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

**OS** (e.g. Win10): Mac OS Catalina 10.15  
**PsychoPy version** (e.g. 1.84.x): Psychopy 3.4.3  
**Standard Standalone? (y/n)** If not then what?:yes  
**What are you trying to achieve?:**  
run the Demo  
**What did you try to make it work?:**  
run the Demo

**What specifically went wrong when you tried that?:**  
Throw the following errors:

defaultKeyboard = keyboard.Keyboard()  
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/hardware/keyboard.py”, line 166, in **init**  
buffer = \_keyBuffers.getBuffer(devId, bufferSize)  
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/hardware/keyboard.py”, line 306, in getBuffer  
kb\_id=kb\_id)  
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/hardware/keyboard.py”, line 334, in **init**  
self.dev = hid.Keyboard(kb\_id) # a PTB keyboard object  
File “psychtoolbox/hid.pyc”, line 137, in **init**  
File “psychtoolbox/hid.pyc”, line 145, in \_create\_queue  
FileNotFoundError: [Errno 2] No such file or directory

Include pasted full error message if possible. “That didn’t work” is not enough information.

---

<div class="post-metadata">

**Author:** ![hannah](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@hannah](https://discourse.psychopy.org/u/hannah)\
**Post date:** [October 14, 2019, 5:18pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/2 "2019-10-14T17:18:38Z")

</div>

Dear all,

I face the same problem (and get the same error messages) within PsychoPy v3.1.5 as well as in PsychoPy v3.2.4 on Mac OS Catalina 10.15.

In addition to the above stated error messages (of Fiona), mine are preceded by further error messages. As I am not sure about possible interactions between those errors, you can find the error messages below:

> PsychHID-ERROR: Could not enumerate and attach to all HID devices (HIDBuildDeviceList(0,0) failed)!  
> PsychHID-ERROR: One reason could be that some HID devices are already exclusively claimed by some 3rd party device drivers  
> PsychHID-ERROR: or applications. I will now retry to only claim control of a hopefully safe subset of devices like standard  
> PsychHID-ERROR: keyboards, mice, gamepads and supported USB-DAQ devices and other vendor defined devices and hope this goes better…  
> PsychHID-INFO: That worked. A subset of regular mouse, keyboard etc. input devices and maybe some vendor defined devices will be available at least.  
> INTERNAL PSYCHTOOLBOX ERROR  
> error: PsychError\_system  
> general description: Error reported by a system call  
> specific description: Failed to create event queue for detecting key press.  
> module name: PsychHID  
> subfunction call: KbQueueCreate  
> file name: ./PsychSourceGL/Source/OSX/PsychHID/PsychHIDStandardInterfaces.c  
> function name: PsychHIDOSKbQueueCreate  
> line number: 956  
> PsychHID:KbQueueCreate: See error message printed above.

Do you have any recommendations/ideas how to fix this/these issue(s)? Or do you need further information?

All the best and thanks in advance,  
Hannah

---

<div class="post-metadata">

**Author:** ![LittleMary](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/littlemary/32/4179_2.png) [@LittleMary](https://discourse.psychopy.org/u/LittleMary)\
**Post date:** [October 14, 2019, 6:39pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/3 "2019-10-14T18:39:33Z")

</div>

Same problem as @hannah. Everything works fine on PC, but we got those error messages when trying the same experience on Mac…

---

<div class="post-metadata">

**Author:** ![fheiuap](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/fheiuap/32/5957_2.png) [@fheiuap](https://discourse.psychopy.org/u/fheiuap)\
**Post date:** [October 15, 2019, 2:16pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/4 "2019-10-15T14:16:32Z")

</div>

The same problem occurred to my computer, and I have found the following solution.

Please go to System Preferences \> Security & Privacy \> Privacy tab \> Input Monitoring (i.e. keyboard icon) \> Add PsychoPy3 by pressing the plus button (i.e. Allow PsychoPy3 to “monitor input from your keyboard even while using other apps”).

I think the new OS has reset our privacy settings and forbidden Psychtoolbox-based keyboard input as a default. I would be happy if this information is helpful to you.

---

<div class="post-metadata">

**Author:** ![hannah](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@hannah](https://discourse.psychopy.org/u/hannah)\
**Post date:** [October 16, 2019, 7:20am UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/5 "2019-10-16T07:20:55Z")

</div>

Thank you for your answer, but actually that does not help in my case. I have the same issues and error messages as before. When trying the demos, the experiment setting window (participant name and session) pops up, afterwards everything closes and I get the error report.

But which PsychoPy version are you using?

---

<div class="post-metadata">

**Author:** ![fheiuap](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/fheiuap/32/5957_2.png) [@fheiuap](https://discourse.psychopy.org/u/fheiuap)\
**Post date:** [October 16, 2019, 8:05am UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/6 "2019-10-16T08:05:50Z")

</div>

I’m using version 3.1.2. The same issue is reported below, and @j_adema solved it by downgrading PsychoPy3. So, PsychoPy version might have something to do with it. I’m sorry but I don’t know anymore.

> [@Bug Report: 'psychtoolbox/hid.pyc' file not found](https://discourse.psychopy.org/t/bug-report-psychtoolbox-hid-pyc-file-not-found/9361):
>
> OS (e.g. Win10): Mac OS Catalina (10.15) PsychoPy version (e.g. 1.84.x): 3.2.4 Standard Standalone? (y/n) If not then what?: y What are you trying to achieve?: Running previously created code on the newest version of PsychoPy What did you try to make it work?: Going to the path to verify present files, comparing with path from PsychoPy 3.2.3. What specifically went wrong when you tried that?: File “psychtoolbox/hid.pyc”, line 137, in init File “psychtoolbox/hid.pyc”, line 145, in \_create…

---

<div class="post-metadata">

**Author:** ![hannah](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@hannah](https://discourse.psychopy.org/u/hannah)\
**Post date:** [October 16, 2019, 8:19am UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/7 "2019-10-16T08:19:18Z")

</div>

Thanks for merging those two topics! That should probably help at least on the short run - I will try it later today.

---

<div class="post-metadata">

**Author:** ![hannah](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@hannah](https://discourse.psychopy.org/u/hannah)\
**Post date:** [October 16, 2019, 9:38am UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/8 "2019-10-16T09:38:25Z")

</div>

Great, this solutions seems to work! Thanks again!

I now tried the 3.1.2-Standalone and the 3.2.3-Standalone. In both cases I changed the privacy settings according to your description @fheiuap. Afterwards at least the demos seem to work…

## A summary of what to do when facing problems with the Mac OS Catalina Update and PsychoPy (3.2.4) - at least on the short run.

Downgrade your PsychoPy3 (3.2.3 seems to work at least for me).  
After installation change your privacy settings according to @fheiuap’s description:

> Please go to System Preferences \> Security & Privacy \> Privacy tab \> Input Monitoring (i.e. keyboard icon) \> Add PsychoPy3 by pressing the plus button (i.e. Allow PsychoPy3 to “monitor input from your keyboard even while using other apps”).

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://discourse.psychopy.org/u/jake)\
**Post date:** [October 23, 2019, 4:15pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/9 "2019-10-23T16:15:57Z")

</div>

Thanks for sharing your solutions!

I just upgraded from macOS Sierra to Catalina and found the same issue about loading keyboard functions on PsychoPy3 (3.1.4). I couldn’t find the plus button on the Input Monitoring under Privacy tab. This panel was just empty.

Instead, I upgraded my current PsychoPy3 v3.1.4 to v3.2.4, run it by allowing an opening access (as it usually complains about unidentified developer) and the issue was gone.

To summarize, I did two things to fix this issue:

1. Upgraded PsychoPy3 to the latest version (v3.2.4) and
2. Allowed an access to open this app.

---

<div class="post-metadata">

**Author:** ![drbenvincent](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/drbenvincent/32/2040_2.png) [@drbenvincent](https://discourse.psychopy.org/u/drbenvincent)\
**Post date:** [October 27, 2019, 12:33pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/10 "2019-10-27T12:33:20Z")

</div>

This does not work for me, with 3.2.4. Although I’m a bit unclear about what you mean by ‘allowing open access’. I’ve given it access to input monitoring as others have mentioned.

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://discourse.psychopy.org/u/jake)\
**Post date:** [October 27, 2019, 3:17pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/11 "2019-10-27T15:17:35Z")

</div>

What I meant by ‘allowing open access’ was as follows.

A small warning window popped up when I opened PsychoPy for the first time after upgrading it the v3.2.4. I clicked the ‘allow’ button on the warning window. Now, this warning is not appearing anymore, so I don’t remember/replicate the exact warning message, but it was about if I want to allow open access for the program that is from the unidentified developers.

I think you can find this message also on ‘Security & Privacy’ panel under System Preferences as in the image below if you missed this warning for some reason or when PsychoPy refused to open.

 ![security](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/d/b/db8a23fe0a90540d593be036f47a496ffe07ae81.png)

Others mentioned adding a keyboard on Input Monitoring, but I couldn’t add anything there, which looks as in the bottom image. I don’t have any issue right now using keyboard input on PsychoPy without adding a keyboard in this panel.

 ![keyboard](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/0/2/0255740f466d60b3a64d48e4ddb1d9469e0a9b53.png)

I don’t know if my solution works for everybody, but this worked for me at least.

---

<div class="post-metadata">

**Author:** ![drbenvincent](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/drbenvincent/32/2040_2.png) [@drbenvincent](https://discourse.psychopy.org/u/drbenvincent)\
**Post date:** [October 28, 2019, 3:45pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/12 "2019-10-28T15:45:15Z")

</div>

Yep. The “open anyway” thing in security settings will have to be done anyway by everyone I believe, so I think you have just been lucky in somehow getting 3.2.4 working with Catalina.

---

<div class="post-metadata">

**Author:** ![drbenvincent](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/drbenvincent/32/2040_2.png) [@drbenvincent](https://discourse.psychopy.org/u/drbenvincent)\
**Post date:** [October 28, 2019, 3:49pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/13 "2019-10-28T15:49:25Z")

</div>

Ok. So downgrading to 3.2.3 as @Hannah says and making sure PsychoPy has access to input monitoring does _not_ fix the problem for me. So as far as I can tell there is no way for me to run PsychoPy experiments on this machine with Catalina. I’ve not yet tried going back to even earlier versions of PsychoPy.

EDIT: This _does_ work if you downgrade to 3.2.3 if you also go into Settings \> Security & Privacy \> Privacy \> Input Monitoring and remove PsychoPy3 then let it add itself back again. 🙂

---

<div class="post-metadata">

**Author:** ![mijdar](https://avatars.discourse-cdn.com/v4/letter/m/50afbb/32.png) [@mijdar](https://discourse.psychopy.org/u/mijdar)\
**Post date:** [November 5, 2019, 3:04pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/14 "2019-11-05T15:04:04Z")

</div>

I had 3.2.3 installed on my computer, and upgraded to 3.2.4. After doing so, I experienced the same problem. This was solved by removing PsychoPy3 from Input Monitoring, and then add it again when starting the software. By doing so I could run 3.2.4 on Catalina. Hope it helps.

---

<div class="post-metadata">

**Author:** ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)\
**Post date:** [November 5, 2019, 4:11pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/15 "2019-11-05T16:11:41Z")

</div>

Thanks @mijdar

Annoying that Mac didn’t previously require it to be in Input Monitoring at all, but I suspect the reason your solution works is that Mac treats 3.2.4 as an entirely separate entity to 3.2.3, which means this might have to be done on every update! ☹

I really need to get the auto-updating via a patch file to work again which would get around the problem.

---

<div class="post-metadata">

**Author:** ![Bill\_Prinzmetal](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@Bill\_Prinzmetal](https://discourse.psychopy.org/u/Bill_Prinzmetal)\
**Post date:** [November 19, 2019, 6:07pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/16 "2019-11-19T18:07:22Z")

</div>

Unfortunately I have to buy a new Mac today and it will be Catalina OSX. Hopefully these hints will help me through. Now that Jon is on it, it will will be fixed. I wonder though its is related to a problem I had with IOHub and the keyboard. I know that IOHub keyboard and the keyboard component are completely different but I am asking this in case it sheds some light on the Apple Permission issues. With Mac OSX Mojave, I could not run the IOHub keyboard, but if I interpreted the program and put it into Anaconda/Spyder, IOHub keyboard programs would work perfectly. I hope I do not run into the Catalina PsychoPy issues, but if keyboard (component) does work with Anaconda, I will be more hopeful that ALL these problems will be solved (until Apple intervenes again). If you try this, let me know.

---

<div class="post-metadata">

**Author:** ![Michael](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/michael/32/16_2.png) [@Michael](https://discourse.psychopy.org/u/Michael)\
**Post date:** [November 19, 2019, 10:44pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/17 "2019-11-19T22:44:31Z")

</div>

Hi Bill, on a related note, if it is only the keyboard aspects you need, then the new PsychToolBox-based `Keyboard` class probably achieves everything you need, without requiring `ioHub`:

[https://www.psychopy.org/api/hardware/keyboard.html](https://www.psychopy.org/api/hardware/keyboard.html)

---

<div class="post-metadata">

**Author:** ![Bill\_Prinzmetal](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@Bill\_Prinzmetal](https://discourse.psychopy.org/u/Bill_Prinzmetal)\
**Post date:** [November 20, 2019, 3:30am UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/18 "2019-11-20T03:30:51Z")

</div>

Michael,

Thanks for replying. It’s a long story. My long-term goal was to make a Toby eyetracker work. I couldn’t do it so I thought maybe the problem was I don’t understand IOHub. So I tried the demos for mouse and keyboard IOhub. They didn’t work with PsychoPy but they did work running under Anaconda. Why? I tried Different versions of PsychoPy , and mostly OSX Mojave.

So then why couldn’t I get to Toby eye monitor to work under Anaconda. Then I discovered one version just will not work, Toby will not give away the code. I tried with the EyeX, which should work and it doesn’t. But now I’m thinking maybe the computer (an old MacBook Air) doesn’t put out enough power in the USB port. But I have to buy a new computer and it will be OS X Catalina. With your note, and the other hints in this discussion, I think the keyboard component won’t be a problem (I hope).

But there still some problem with securities and permissions with OS X Mojave and PsychoPy, at least on my computer. There’s nothing wrong with the demonstration code, it works perfectly when the .py is run with Anaconda, But not with PsychoPy. But this doesn’t appear to have been a problem for other people. So it must be some privacy permission was set incorrectly in my computer and I don’t know how to fix it.

For now I’m going to give up on IOhub. There are a lot of suggestions on the keyboard component, so I expect that will work.

Bill Prinzmetal

---

<div class="post-metadata">

**Author:** ![mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@mark](https://discourse.psychopy.org/u/mark)\
**Post date:** [January 4, 2020, 6:37pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/19 "2020-01-04T18:37:32Z")

</div>

Sorry to resurrect this old thread but is there a reliable way of getting psychopy to run with a keyboard on MacOS Catalina? I’m using 10.15.2 and psychopy 3.2.4. I’ve tried suggestions previously made such as ensuring psychopy has an entry for input monitoring within system preferences. I’ve downgraded to psychopy 3.2.3 then gone back to 3.2.4 but still get the same error. Below is what is produced when running the BART demo. Any suggestions would really be appreciated.

######### Running: /Users/mscase/Documents/psypy/BART/bart\_lastrun.py ##########  
PsychHID-ERROR: Could not enumerate and attach to all HID devices (HIDBuildDeviceList(0,0) failed)!  
PsychHID-ERROR: One reason could be that some HID devices are already exclusively claimed by some 3rd party device drivers  
PsychHID-ERROR: or applications. I will now retry to only claim control of a hopefully safe subset of devices like standard  
PsychHID-ERROR: keyboards, mice, gamepads and supported USB-DAQ devices and other vendor defined devices and hope this goes better…  
PsychHID-INFO: That worked. A subset of regular mouse, keyboard etc. input devices and maybe some vendor defined devices will be available at least.  
INTERNAL PSYCHTOOLBOX ERROR  
error: PsychError\_system  
general description: Error reported by a system call  
specific description: Failed to create event queue for detecting key press.  
module name: PsychHID  
subfunction call: KbQueueCreate  
file name: ./PsychSourceGL/Source/OSX/PsychHID/PsychHIDStandardInterfaces.c  
function name: PsychHIDOSKbQueueCreate  
line number: 956  
PsychHID:KbQueueCreate: See error message printed above.  
12.9358 WARNING User requested fullscreen with size [2560 1440], but screen is actually [1440, 900]. Using actual size  
2020-01-04 18:31:20.190 python[39631:1816295] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)  
Traceback (most recent call last):  
File “/Users/mscase/Documents/psypy/BART/bart\_lastrun.py”, line 78, in   
defaultKeyboard = keyboard.Keyboard()  
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/hardware/keyboard.py”, line 166, in **init**  
buffer = \_keyBuffers.getBuffer(devId, bufferSize)  
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/hardware/keyboard.py”, line 306, in getBuffer  
kb\_id=kb\_id)  
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/hardware/keyboard.py”, line 334, in **init**  
self.dev = hid.Keyboard(kb\_id) # a PTB keyboard object  
File “psychtoolbox/hid.pyc”, line 137, in **init**  
File “psychtoolbox/hid.pyc”, line 145, in \_create\_queue  
FileNotFoundError: [Errno 2] No such file or directory

---

<div class="post-metadata">

**Author:** ![mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@mark](https://discourse.psychopy.org/u/mark)\
**Post date:** [January 6, 2020, 7:12pm UTC](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389/20 "2020-01-06T19:12:54Z")

</div>

Problem solved!  
Of course it was something trivial but might catch others so here is what I found out.  
As others have pointed out PsychoPy needs to be added to Input Monitoring within Security & Privacy. However, as well as adding PsychoPy you need to ensure that the box is ticked just to left of the PsychoPy icon after it has been added to Input Monitoring.  
If the box is ticked then everything works! If it isn’t then you get the above error.  
I hope this helps someone.  
PS this is PsychoPy 3.2.4 running on Catalina 10.15.2

[Next page](https://discourse.psychopy.org/t/keyboard-psychtoolbox-hid-failing-with-mac-os-catalina-update/9389.md?page=2)
