Cannot connect using the python wrapper for Metawear

Hi team,
I am having issues connecting to metawear using the python wrapper api.
This is the error I am getting, can someone help or point out the issue here ?

error 1533846775.660968: Error on line: 296 (src/blestatemachine.cc): Operation now in progress

Comments

  • That message can be ignored.

    Monitor the BT activity and confirm that a connection is indeed failing to be made.

  • Perfect ! Works just fine

  • Hi Eric:
    I did a fresh reinstall of MetaWear-SDK-Python following the instructions in
    I am having the same error message. Nothing happens on the device (MetaMotionC). I have to KeyboardInterrupt.
    Here is the trace.

    Appreciate your help.

    $ python led.py "F9:4E:B7:A1:F7:CE"error 1540422236.556516: Error on line: 296 (src/blestatemachine.cc): Operation now in progress

    ^CTraceback (most recent call last):
    File "led.py", line 11, in
    device.connect()
    File "/home/pi/SSquare/sspy35_env/lib/python3.5/site-packages/mbientlab/metawear/metawear.py", line 143, in connect
    e.wait()
    File "/usr/lib/python3.5/threading.py", line 549, in wait
    signaled = self._cond.wait(timeout)
    File "/usr/lib/python3.5/threading.py", line 293, in wait
    waiter.acquire()
    KeyboardInterrupt

  • Quoting my previous post:

    @Eric said:
    That message can be ignored.

    Monitor the BT activity and confirm that a connection is indeed failing to be made.

  • I ignore it. But nothing happens. LED does not bling.
    So I Control-C to exit.

  • Read the second sentence from my post.

  • Eric:

    Yes, I read the second sentence. There is no activity.
    Its stuck in connection.
    File "/home/pi/SSquare/sspy35_env/lib/python3.5/site-packages/mbientlab/metawear/metawear.py", line 143, in connect

    What's the solution? I checked that battery is alive.

    Appreciate your help.

    Thanks,
    Raj

  • My post asked you to monitor the BT activity. If you have done so, post a log of what the BT adapter was doing when you ran the led script.

  • I have two virtual python environments Python 2.7 and Python3.5 in which I installed the metawear packages.
    I had some installation errors installing some dependencies for metawear in Python3.5 so metawear python examples hanged in connect.

    Fortunately, in Python2.7 the example scripts (e.g. led.py) work fine.

    In Python3.5 installation, pip install pybluez[ble] failed because,
    /usr/bin/ld: cannot find -lboost_python-py34
    collect2: error: ld returned 1 exit status
    error: command 'arm-linux-gnueabihf-g++' failed with exit status 1
    So, In /usr/lib/arm-linux-gnueabihf, I did a symbolic link:
    i. sudo ln -s libboost_python-py35.so.1.62.0 libboost_python-py34.so
    ii. With that, the build succeeded, but not working.

    So for now, I can continue in Python2.7 environment and try to do a clean install metawear packages later.

    If anyone else had similar problem installing metawear packages in Python3.x environment and got it working, your please share any insight you may have.

    Thanks

  • @Eric said:
    My post asked you to monitor the BT activity. If you have done so, post a log of what the BT adapter was doing when you ran the led script.

    how exactly would you monitor the BT activity? is there a cli command. am on raspbian. thank u

  • Check out tools like btmon, learn to use it.

  • edited February 5

    Hi all,

    A few updates. First I updated the tutorials to include a Ubuntu based setup, please see here: https://mbientlab.com/tutorials/Linux.html.

    Second, I ran a few examples and did notice that a few times you may get an error because the BLE fails to connect. You either need to try to connect again or update the Python scripts to automatically try to connect again.

    It also helps to verify this by running: sudo btmon

    That being said, on Ubuntu and Python2.7, the Python MetaWear SDK does work fine:

    The LED successfully turned on in this example and the BTMON shows a successful command set.

    Continue to ignore the src/blestatemachine.cc error.

Sign In or Register to comment.