1

I'm trying to compile a file from the SDK for the headset Emotiv Epoc. But when I compile it I get this error message:

"Traceback (most recent call last):
 File "emotiv.py", line 419, in 
 a.setup()
 File "emotiv.py", line 232, in setup
 self.setupWin()
 File "emotiv.py", line 305, in setupWin
gevent.spawn(self.setupCrypto, self.serialNum)
AttributeError: 'Emotiv' object has no attribute 'serialNum'"

I checked the piece of code that gave me this error:

    def setupWin(self):
    devices = []
    try:
        for device in hid.find_all_hid_devices():
            if device.vendor_id != 0x21A1:
                continue
            if device.product_name == 'Brain Waves':
                devices.append(device)
                device.open()
                self.serialNum = device.serial_number
                device.set_raw_data_handler(self.handler)
            elif device.product_name == 'EPOC BCI':
                devices.append(device)
                device.open()
                self.serialNum = device.serial_number
                device.set_raw_data_handler(self.handler)
            elif device.product_name == '00000000000':
                devices.append(device)
                device.open()
                self.serialNum = device.serial_number
                device.set_raw_data_handler(self.handler)
        gevent.spawn(self.setupCrypto, self.serialNum)**<-- the error line**
        gevent.spawn(self.updateStdout)

I need this for a school project. I'm new at python, so I don't know what could it be, I already posted this issue in the emokit sdk site, but I got no answer. This is the web site for the whole code: https://github.com/openyou/emokit/blob/master/python/emokit/emotiv.py Any help would be appreciate it.

pylover
  • 7,670
  • 8
  • 51
  • 73
Rosie
  • 94
  • 2
  • 11
  • 1
    add an `else: raise ValueError("Shouldn't have gotten here!")` to before the `gevent.spawn` code and that might help you get clearer on the error. I bet you are falling off the if statements without setting `serialNum` anywhere in your code. You should figure out what's causing that to happen and add another case, etc. – Jeff Tratner May 18 '13 at 01:40
  • You might also try with https://github.com/nh2/hemokit. – nh2 Jan 13 '14 at 00:41

1 Answers1

0

On more recent EPOCs, the vendor_id has changed. Try replacing the line:

if device.vendor_id != 0x21A1:

with

if device.vendor_id != 0x21A1 and device.vendor_id != 0x1234:

Someone noticed this already and opened a ticket on the emokit Github page.

Marijn van Vliet
  • 5,239
  • 2
  • 33
  • 45