Skip to content

Commit

Permalink
Fix TypeErrors for Python3 (#59)
Browse files Browse the repository at this point in the history
* Fix TypeError on missing encoding
* Fix TypeError from bytearray()
  • Loading branch information
twdkeule authored and rm-hull committed Jan 19, 2017
1 parent 48e0b13 commit bf4b738
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions luma/led_matrix/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ def text(self):

@text.setter
def text(self, value):
self._text_buffer = observable(bytearray(value, "uft-8"), observer=self.flush)
self._text_buffer = observable(bytearray(value, "utf-8"), observer=self.flush)
self.flush(self._text_buffer)

def flush(self, buf):
data = bytearray(self.segment_mapper(buf, notfound=self.undefined), "utf-8").ljust(self._bufsize, '\0')
data = bytearray(self.segment_mapper(buf, notfound=self.undefined)).ljust(self._bufsize, b'\0')

if len(data) > self._bufsize:
raise OverflowError("Device's capabilities insufficent for value '{0}'".format(self._text_buffer))
Expand Down
2 changes: 1 addition & 1 deletion luma/led_matrix/segment_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def regular(text, notfound="_"):

def dot_muncher(text, notfound="_"):
undefined = _DIGITS[notfound]
iterator = iter(text.decode("utf-8"))
iterator = iter(text)
last = _DIGITS.get(next(iterator))
try:
while True:
Expand Down

0 comments on commit bf4b738

Please sign in to comment.