diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/miniterm.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/examples/miniterm.py b/examples/miniterm.py index 25b1e44..7290783 100644 --- a/examples/miniterm.py +++ b/examples/miniterm.py @@ -176,12 +176,17 @@ class Miniterm: sys.stderr.write('--- hardware flow control %s\n' % (self.serial.rtscts and 'active' or 'inactive')) sys.stderr.write('--- data escaping: %s\n' % (REPR_MODES[self.repr_mode],)) sys.stderr.write('--- linefeed: %s\n' % (LF_MODES[self.convert_outgoing],)) - sys.stderr.write('--- CTS: %s DSR: %s RI: %s CD: %s\n' % ( - (self.serial.getCTS() and 'active' or 'inactive'), - (self.serial.getDSR() and 'active' or 'inactive'), - (self.serial.getRI() and 'active' or 'inactive'), - (self.serial.getCD() and 'active' or 'inactive'), - )) + try: + sys.stderr.write('--- CTS: %s DSR: %s RI: %s CD: %s\n' % ( + (self.serial.getCTS() and 'active' or 'inactive'), + (self.serial.getDSR() and 'active' or 'inactive'), + (self.serial.getRI() and 'active' or 'inactive'), + (self.serial.getCD() and 'active' or 'inactive'), + )) + except serial.SerialException: + # on RFC 2217 ports it can happen to no modem state notification was + # yet received. ignore this error. + pass def reader(self): """loop and copy serial->console""" |