mirror of
https://github.com/python-escpos/python-escpos
synced 2025-08-24 09:03:34 +00:00
Attempt to flush before quitting
This commit is contained in:

committed by
Davis Goglin

parent
a445c4205a
commit
ee223670bf
@@ -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()
|
||||
|
Reference in New Issue
Block a user