Skip to content

Commit

Permalink
Python 3: Bytes cannot be decoded with bad baudrate
Browse files Browse the repository at this point in the history
  • Loading branch information
hroncok committed Feb 13, 2018
1 parent b2d83e4 commit 7161b0d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion printrun/printcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,12 @@ def reset(self):
def _readline(self):
try:
try:
line = self.printer.readline().decode('ascii')
try:
line = self.printer.readline().decode('ascii')
except UnicodeDecodeError:
self.logError(_("Got rubbish reply from %s at baudrate %s:") % (self.port, self.baud) +
"\n" + _("Maybe a bad baudrate?"))
return None
if self.printer_tcp and not line:
raise OSError(-1, "Read EOF from socket")
except socket.timeout:
Expand Down

0 comments on commit 7161b0d

Please sign in to comment.