psychopy.org | Reference | Downloads | Github

Keyboard psychhid FileNotFoundError: [Errno 2] No such file or directory

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

The experiment run well on other computers, but my laptop cannot run it. I re-install psychopy several times, but the same problem still show. Please help. Thanks!

I don’t know. I haven’t seen that error before. Could you tell us more about the laptop, particularly about the keyboard settings (How old is the device? Is this an unusual locale? is there a USB keyboard connected or is this the built-in keyboard? Anything else that’s different about this machine?)

To get rid of this error you can try using Python file exists methods to check that at least python sees the file exists or not. In other words, you can make sure that the user has indeed typed a correct path for a real existing file. If the user does not pass the full path to the file, the path is interpreted relatively to the current working directory. The current working directory usually is the directory in which you started the program.