From ee223670bf79ef27b23c31c9864f506536ad761d Mon Sep 17 00:00:00 2001 From: davisgoglin Date: Sat, 19 Mar 2016 20:08:20 -0700 Subject: [PATCH] Attempt to flush before quitting --- escpos/printer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/escpos/printer.py b/escpos/printer.py index baff92e..5a4d126 100644 --- a/escpos/printer.py +++ b/escpos/printer.py @@ -151,6 +151,7 @@ class Serial(Escpos): def __del__(self): """ Close Serial interface """ if self.device is not None: + self.device.flush() self.device.close() @@ -209,6 +210,7 @@ class Network(Escpos): def __del__(self): """ Close TCP connection """ + self.device.shutdown(socket.SHUT_RDWR) self.device.close() @@ -256,4 +258,5 @@ class File(Escpos): def __del__(self): """ Close system file """ + self.device.flush() self.device.close()