diff --git a/meshtastic/stream_interface.py b/meshtastic/stream_interface.py index dc4109e..82b6ab5 100644 --- a/meshtastic/stream_interface.py +++ b/meshtastic/stream_interface.py @@ -104,7 +104,7 @@ class StreamInterface(MeshInterface): def _writeBytes(self, b: bytes) -> None: """Write an array of bytes to our stream and flush""" - if self.stream and self.stream is not None and getattr(self.stream, "is_open", False): # ignore writes when stream is closed + if self.stream: # ignore writes when stream is closed self.stream.write(b) self.stream.flush() # win11 might need a bit more time, too @@ -116,7 +116,7 @@ class StreamInterface(MeshInterface): def _readBytes(self, length) -> Optional[bytes]: """Read an array of bytes from our stream""" - if self.stream and self.stream is not None and getattr(self.stream, "is_open", False): + if self.stream: return self.stream.read(length) else: return None @@ -226,12 +226,10 @@ class StreamInterface(MeshInterface): logger.error( f"Unexpected OSError, terminating meshtastic reader... {ex}" ) - traceback.print_exc() except Exception as ex: logger.error( f"Unexpected exception, terminating meshtastic reader... {ex}" ) - traceback.print_exc() finally: logger.debug("reader is exiting") self._disconnected()