Skip to content

Commit

Permalink
decode data with replace error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongyihui committed Jun 21, 2020
1 parent f3e75b6 commit 72ac946
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions terminal_s/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,10 @@ def read_input():

line = device.readline()
if line:
print(line.decode(), end='', flush=True)
print(line.decode(errors='replace'), end='', flush=True)
except IOError:
print('Device is disconnected')
break
except UnicodeDecodeError:
print([x for x in line])

device.close()

Expand Down

0 comments on commit 72ac946

Please sign in to comment.