Skip to content

Error when using multiple threads  #7

@tanasi

Description

@tanasi

Hi,
first of all thanks for this valuable work.
I am trying to use the mindwave functionality into another python script which uses threading. I can see that threading is used inside mindwave.py in order to get data from dongle. What I am trying to accomplish is to have a master python script which runs 2 or 3 threads. One of them will be mindwave.py.
So, for example I have the following code:

!/usr/bin/env python

from future import print_function
import threading
import time
import mindwave

class MyThread(threading.Thread):
def run(self):
print("{} started!".format(self.getName()))
time.sleep(1)
print("{} finished!".format(self.getName()))

if name == 'main':
mythread = MyThread()
mythread.start()
h1 = mindwave.Headset('/dev/rfcomm0')
h1.connect()
time.sleep(.9)

and I get the following error:
Thread-1 started!
Thread-1 finished!
Exception in thread Thread-2 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
File "/usr/lib/python2.7/dist-packages/mindwave.py", line 74, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'

Do you have any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions