krontech / pychronos

Python bindings for the Chronos High Speed Camera
GNU General Public License v3.0
3 stars 2 forks source link

API crashes sometimes when getting battery voltage. #20

Closed DDR0 closed 5 years ago

DDR0 commented 5 years ago

Reproduction: Run this command ten times:

gdbus call --system --dest ca.krontech.chronos.control --object-path /ca/krontech/chronos/control --method ca.krontech.chronos.control.get "['resolution']"

Some of the commands will produce the following traceback:

api2.DBusException: org.freedesktop.DBus.Python.ValueError: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/service.py", line 707, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "cam_control.py", line 248, in get
    data[name] = self.dbusifyTypes(getattr(self.camera, name))
  File "/root/pychronos/pychronos/camera.py", line 1039, in batteryVoltage
    self.power.queryPowerSocket(self.power)
  File "/root/pychronos/power.py", line 81, in queryPowerSocket
    self.parsePower(self, ret)
  File "/root/pychronos/power.py", line 30, in parsePower
    value = int(elements[2*i + 1].decode('utf8'))
ValueError: invalid literal for int() with base 10: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0

Environment: pychronos on master 2019-07-11 pcUtil_noPoll running in daemon mode

DDR0 commented 5 years ago

This is fixed in the non-polling-power branch. It just needs to be merged, @oskirby?