pythonmacoshidhidapi

getting 'ValueError: not open' when trying to open a connection with hidapi/hid on OSX


I am using python to open a hid/hidapi (the error is the same either way) connection on OSX El Capitan. However, It gives me the following error stacktrace:

 Traceback (most recent call last):
  File "/Users/johndoe/Library/Python/2.7/lib/python/site-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "/Users/johndoe/IdeaProjects/projectname/emokit-master/python/emokit/emotiv.py", line 403, in setup
    self.setup_darwin()
  File "/Users/johndoe/IdeaProjects/projectname/emokit-master/python/emokit/emotiv.py", line 526, in setup_darwin
    data = hidraw.read(34)
  File "hid.pyx", line 105, in hid.device.read (hid.c:2338)
ValueError: not open
<Greenlet at 0x10f7f1b90: <bound method Emotiv.setup of <emokit.emotiv.Emotiv object at 0x10f532c50>>> failed with ValueError

I can't find anything on this, and do not usually use OSX or python, so I am at a bit of a loss


Solution

  • Often, hidapi needs sudo permissions on a mac for some reason. Even if you are running Ubuntu on a mac.