Skip to content

Commit

Permalink
Python 3: When talking to the printer, decode early, encode late
Browse files Browse the repository at this point in the history
  • Loading branch information
hroncok committed Feb 13, 2018
1 parent 32e2331 commit b2d83e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions printrun/printcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def reset(self):
def _readline(self):
try:
try:
line = self.printer.readline()
line = self.printer.readline().decode('ascii')
if self.printer_tcp and not line:
raise OSError(-1, "Read EOF from socket")
except socket.timeout:
Expand Down Expand Up @@ -658,7 +658,7 @@ def _send(self, command, lineno = 0, calcchecksum = False):
try: self.sendcb(command, gline)
except: self.logError(traceback.format_exc())
try:
self.printer.write(str(command + "\n"))
self.printer.write((command + "\n").encode('ascii'))
if self.printer_tcp:
try:
self.printer.flush()
Expand Down

0 comments on commit b2d83e4

Please sign in to comment.