Neuropy library TypeError: __init__() missing 1 required positional argument: 'port'

127 Views Asked by At

I'm using neurosky mindwave kit, so I downloaded Neuropy library to obtain the kit's readings, I tried a sample code:

from NeuroPy.NeuroPy import NeuroPy
from time import sleep

neuropy = NeuroPy() 

def attention_callback(attention_value):
    """this function will be called everytime NeuroPy has a new value for attention"""
    print ("Value of attention is: ", attention_value)
    return None

neuropy.setCallBack("attention", attention_callback)
neuropy.start()

try:
    while True:
        sleep(0.2)
finally:
    neuropy.stop()

and I get this error:

TypeError: __init__() missing 1 required positional argument: 'port'

does anyone know how to fix this, please?

1

There are 1 best solutions below

0
B L Λ C K On

Check the documentation

It clearly says You can pass the Port as an argument in the constructor

Initialising:

Windows 
neuropy = NeuroPy("COM6",57600)  

Linux 
neuropy = NeuroPy("/dev/rfcomm0",57600)