From 4011b9d9af9ba30ba99ea8858cec7f773a84a1cb Mon Sep 17 00:00:00 2001 From: famato <389626@mail.muni.cz> Date: Fri, 28 Sep 2018 22:50:48 +0200 Subject: [PATCH] Added support for Python 3.7 in byte_to_binary On some devices, python 3.7 throws the error: "int object is not iterable". The changes I made solves this problem --- pyvantagepro/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyvantagepro/utils.py b/pyvantagepro/utils.py index 16a1e91..db767ff 100644 --- a/pyvantagepro/utils.py +++ b/pyvantagepro/utils.py @@ -136,7 +136,10 @@ def bytes_to_binary(values): if values == 0: data = '00000000' else: - data = ''.join([byte_to_binary(b) for b in values]) + if type(values) is int: + data = ''.join([byte_to_binary(values)]) + else: + data = ''.join([byte_to_binary(b) for b in values]) else: data = ''.join(byte_to_binary(ord(b)) for b in values) return data