Python working environment

Hi,

I have read all post regarding python and since I have some troubles, wanted to ask a question regarding Python working environment.
I have installed python sdk in two VMs where win10 64bit is host OS and I’m using an USB Bluetooth dongle (CSR8510A10) and bluetoothctl to check the bluetooth connectivity.

    • VM1: Ubuntu 16.04.4 (python 2.7.13, metawear 0.3.1, gattlib 0.20171002, BlueZ 5.37)
    • VM2: Debian 9.4.0 (python 2.7.13, metawear 0.3.1, gattlib 0.20171002, BlueZ 5.43-2+deb9u1)

Although the installation is successful and I’m superuser, 95% of the cases I’m getting errors when I execute examples provided in the examples folder (anonymous_datasignals.py led.py multi_device.py scan_connect.py) and also the test.py example.
I’m getting different errors for the same example and also for the others (full error log is below):

    • RuntimeError: Device is not responding!
    • Segmentation fault
    • (process:1684): GLib-CRITICAL **: Source ID 57 was not found when attempting to remove it

I think that the gattlib or blueZ is causing those kind of random errors however I have seen posts in the forum where python sdk works fine on Ubuntu 16.04 and openSUSE tumbleweed VMs (https://mbientlab.com/community/discussion/comment/5708#Comment_5708) and posts where is stated that sometimes python sdk has connect errors on occasion (https://mbientlab.com/community/discussion/comment/5547#Comment_5547).

My question is in which environment have you used to test python sdk respectively in which environment can I use the python sdk without having above problems (which OS-32 or 64 bit, blueZ version, python, metawear, gattlib etc.)?

Thanks

============================================================================================
root@debian:/home/akah/Downloads/MetaWear-SDK-Python# python test.py DF:01:32:E7:34:54
Connected
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 315, in 'calling callback function'
File "/home/akah/Downloads/MetaWear-SDK-Python/mbientlab/metawear/init.py", line 207, in _read_gatt_char
raw = self.gatt.read_by_uuid(uuid)[0]
RuntimeError: Device is not responding!
model = 140223492130735
Sampling data
collected samples = 0
(process:1684): GLib-CRITICAL **: Source ID 57 was not found when attempting to remove it
Disconnected

============================================================================================
root@debian:/home/akah/Downloads/MetaWear-SDK-Python# python test.py DF:01:32:E7:34:54
Connected
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 315, in 'calling callback function'
File "/home/akah/Downloads/MetaWear-SDK-Python/mbientlab/metawear/init.py", line 231, in _enable_notifications
self.gatt.write_by_handle(handle + 1, b'\x01\x00')
RuntimeError: Device is not responding!
Segmentation fault

============================================================================================
root@debian:/home/akah/Downloads/MetaWear-SDK-Python# python test.py DF:01:32:E7:34:54
Traceback (most recent call last):
File "test.py", line 12, in
device.connect()
File "/home/akah/Downloads/MetaWear-SDK-Python/mbientlab/metawear/init.py", line 167, in connect
for s in self.gatt.discover_primary():
RuntimeError: Device is not responding!

============================================================================================
root@debian:/home/akah/Downloads/MetaWear-SDK-Python# python test.py DF:01:32:E7:34:54
Connected
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 315, in 'calling callback function'
File "/home/akah/Downloads/MetaWear-SDK-Python/mbientlab/metawear/init.py", line 231, in _enable_notifications
self.gatt.write_by_handle(handle + 1, b'\x01\x00')
RuntimeError: Device is not responding!
Segmentation fault

Comments

  • We are working on swapping out gattlib for libblepp, which appears to be far more reliable than anything currently available for Python.

    Give his library a shot and see it provides better stability in your VMs.

This discussion has been closed.