Emokit SDK: 'Emotiv' object has no attribute 'serialNum' in Python

989 Views Asked by At

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.

1

There are 1 best solutions below

0
On

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.