Home › Forums › Mooshimeter Support › TypeError during connection with Python API
- This topic has 4 replies, 2 voices, and was last updated 7 years ago by
admin.
- AuthorPosts
Barney
GuestHi,
Am experimenting with using the Python API but the following error keeps being thrown during the main_meter.connect() call:
Traceback (most recent call last):
File “example.py”, line 57, in <module>
main_meter.connect()
File “C:\Users\delphinus\repos\denebola\Mooshimeter-PythonAPI\Mooshimeter.py”, line 220, in connect
self.meter_serout.enableNotify(True,tmp_cb)
File “C:\Users\delphinus\repos\denebola\Mooshimeter-PythonAPI\BGWrapper.py”, line 58, in enableNotify
self.p.enableNotify(self.uuid, enable)
File “C:\Users\delphinus\repos\denebola\Mooshimeter-PythonAPI\BGWrapper.py”, line 149, in enableNotify
raise
TypeError: exceptions must be old-style classes or derived from BaseException, not NoneTypeHas anyone else experienced this issue?
Thanks,
BarneyAnonymous
GuestJust in case any one needs to know…!
A firmware update via the iPhone app seemed to sort the issue, although the packets seem to be arriving very intermittently, so I need to get to the bottom of that now.
Thanks
admin
KeymasterHi Barney,
I looked at the error and corrected it. Check the master branch on the github repo.
It looks like the script was having trouble enabling notifications for your meter because something went wrong in the characteristic discovery process. I’m not sure what would cause that. Please let me know if the issue keeps coming up and what changes.
Thanks!
~JamesAnonymous
GuestThanks James, I’ll check it out and will let you know if it recurs.
Also, you wouldn’t happen to know why the output to the screen seems slow (i.e. in the order of one sample per two seconds with both Ch.A and Ch.B activated)? I’ve not changed the default set-up values.
Thanks again,
Barneyadmin
KeymasterAh! Thanks for pointing that out.
I looked at the Example.py script. See the lines that say:
12main_meter.sendCommand('sampling:rate 0') # Rate 125Hzmain_meter.sendCommand('sampling:depth 3') # Depth 256You can mess with those to change the sample rates. Right now it’s set to 125Hz, 256 samples (so about 1 sample/2seconds, just as you observed). sampling:rate 1 would give 250Hz, sampling:rate 2 would give 500Hz, etc. sampling:depth 2 gives buffer depth 128, etc. So if you change to
12main_meter.sendCommand('sampling:rate 0') # Rate 125Hzmain_meter.sendCommand('sampling:depth 1') # Depth 64That should give a sample every 0.5second
~James
- AuthorPosts