From b99c076baec6f73631a70910e399401897ee6c0b Mon Sep 17 00:00:00 2001 From: Christoph Heuel Date: Tue, 19 May 2015 02:52:55 +0200 Subject: [PATCH] Fix for string operation * With Python version 3 data and text are treated different. Convert the * text accordingly. --- escpos/printer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/escpos/printer.py b/escpos/printer.py index 31b00c0..de88814 100644 --- a/escpos/printer.py +++ b/escpos/printer.py @@ -159,7 +159,10 @@ class File(Escpos): def _raw(self, msg): """ Print any command sent in raw format """ - self.device.write(msg); + if type(msg) is str: + self.device.write(msg.encode()); + else: + self.device.write(msg); def __del__(self):