diff --git a/src/escpos/printer.py b/src/escpos/printer.py index 59bacad..47834f6 100644 --- a/src/escpos/printer.py +++ b/src/escpos/printer.py @@ -242,7 +242,10 @@ class Network(Escpos): def close(self): """ Close TCP connection """ if self.device is not None: - self.device.shutdown(socket.SHUT_RDWR) + try: + self.device.shutdown(socket.SHUT_RDWR) + except socket.error: + pass self.device.close()