serialhdl: Catch SerialException as well as OSError on serial open

Catch the right exceptions so that a retry is possible when attempting
to open the serial port.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-03-15 20:45:27 -04:00
parent e60779bfe1
commit d2027cb4a9
1 changed files with 1 additions and 1 deletions

View File

@ -65,7 +65,7 @@ class SerialReader:
starttime = self.reactor.monotonic() starttime = self.reactor.monotonic()
try: try:
self.ser = serial.Serial(self.serialport, self.baud, timeout=0) self.ser = serial.Serial(self.serialport, self.baud, timeout=0)
except OSError, e: except (OSError, serial.SerialException), e:
logging.warn("Unable to open port: %s" % (e,)) logging.warn("Unable to open port: %s" % (e,))
self.reactor.pause(starttime + 5.) self.reactor.pause(starttime + 5.)
continue continue