Problem upgrading to newest python API
Hi,
I have been using the API through the pymetawear package (version 0.8.0). I would like to upgrade my code to the official Python SDK, but I fail to run even the led.py example.
I created a new pip virtual environment, installed mbientlab version of pygattlib and metawear packages.
When trying to run the examples in the examples folder, e.g. python led.py MAC_ADDRESS, I get one of the two following errors:
-----------------------------------------
Traceback (most recent call last):
File "led.py", line 10, in <module>
device.connect()
File "/home/aribes/Environments/metawear/local/lib/python2.7/site-packages/mbientlab/metawear/__init__.py", line 155, in connect
self.gatt.connect(True, channel_type='random')
RuntimeError: Channel or attrib not ready
-------------------------------------------
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 315, in 'calling callback function'
File "/home/aribes/Environments/metawear/local/lib/python2.7/site-packages/mbientlab/metawear/__init__.py", line 198, in _read_gatt_char
raw = self.gatt.read_by_uuid(uuid)[0]
RuntimeError: Device is not responding!
Traceback (most recent call last):
File "led.py", line 10, in <module>
device.connect()
File "/home/aribes/Environments/metawear/local/lib/python2.7/site-packages/mbientlab/metawear/__init__.py", line 189, in connect
raise RuntimeError("Error initializing the API (%d)" % (self.init_status))
RuntimeError: Error initializing the API (16)
-------------------------------------------------------
But if I then switch to version 0.8.0 of pymetawear (which wraps Cpp API), it works well.
Also I noted that pymetawear develop version (0.9.x) is a wrapper around official python wrapper. I am also not able to use it (obviously, if official python sdk does not work, that pymetawear version should not as well).
This discussion has been closed.
Comments
What bluez version are using?