Skip to content

Commit

Permalink
Update to Python 3.9
Browse files Browse the repository at this point in the history
Fix AttributeError: 'array.array' object has no attribute 'fromstring'
  • Loading branch information
mikacousin committed Dec 2, 2020
1 parent 1965826 commit 3ff957f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions python/ola/OlaClient.py
Expand Up @@ -1173,7 +1173,10 @@ def UpdateDmxData(self, controller, request, callback):

if request.universe in self._universe_callbacks:
data = array.array('B')
data.fromstring(request.data)
if sys.version >= '3.2':
data.frombytes(request.data)
else:
data.fromstring(request.data)
self._universe_callbacks[request.universe](data)
response = Ola_pb2.Ack()
callback(response)
Expand Down Expand Up @@ -1478,7 +1481,10 @@ def _GetDmxComplete(self, callback, controller, response):

if status.Succeeded():
data = array.array('B')
data.fromstring(response.data)
if sys.version >= '3.2':
data.frombytes(response.data)
else:
data.fromstring(response.data)
universe = response.universe

callback(status, universe, data)
Expand Down

0 comments on commit 3ff957f

Please sign in to comment.