Attempt to flush before quitting

This commit is contained in:
davisgoglin 2016-03-19 20:08:20 -07:00 committed by Davis Goglin
parent a445c4205a
commit ee223670bf
1 changed files with 3 additions and 0 deletions

View File

@ -151,6 +151,7 @@ class Serial(Escpos):
def __del__(self): def __del__(self):
""" Close Serial interface """ """ Close Serial interface """
if self.device is not None: if self.device is not None:
self.device.flush()
self.device.close() self.device.close()
@ -209,6 +210,7 @@ class Network(Escpos):
def __del__(self): def __del__(self):
""" Close TCP connection """ """ Close TCP connection """
self.device.shutdown(socket.SHUT_RDWR)
self.device.close() self.device.close()
@ -256,4 +258,5 @@ class File(Escpos):
def __del__(self): def __del__(self):
""" Close system file """ """ Close system file """
self.device.flush()
self.device.close() self.device.close()