handle socket error when closing

This commit is contained in:
Patrick Kanzler 2020-11-08 22:34:57 +01:00
parent 0758a79e64
commit 36bbb6690f
1 changed files with 4 additions and 1 deletions

View File

@ -242,7 +242,10 @@ class Network(Escpos):
def close(self):
""" Close TCP connection """
if self.device is not None:
try:
self.device.shutdown(socket.SHUT_RDWR)
except socket.error:
pass
self.device.close()