diff options
author | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2014-08-04 10:35:10 +0000 |
---|---|---|
committer | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2014-08-04 10:35:10 +0000 |
commit | 49485887d2a9b0f26cdff6f96e66ac3432127225 (patch) | |
tree | 390b4b32fe5852392448d50f812acb05b605b70a | |
parent | 77e088a89dd21b18a69fd9a3ff872b199d4439e9 (diff) | |
download | pyserial-git-49485887d2a9b0f26cdff6f96e66ac3432127225.tar.gz |
[Bug pyserial:156] PosixSerial.open raises OSError rather than SerialException when port open fails
-rw-r--r-- | pyserial/CHANGES.txt | 2 | ||||
-rw-r--r-- | pyserial/serial/serialposix.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/pyserial/CHANGES.txt b/pyserial/CHANGES.txt index 663dbeb..f9cf277 100644 --- a/pyserial/CHANGES.txt +++ b/pyserial/CHANGES.txt @@ -494,6 +494,8 @@ Bugfixes: Bugfixes (posix): +- [Bug pyserial:156] PosixSerial.open raises OSError rather than + SerialException when port open fails - [Bug pyserial:163] serial.tools.list_ports.grep() fails if it encounters None type Bugfixes (cli): diff --git a/pyserial/serial/serialposix.py b/pyserial/serial/serialposix.py index 43004b3..78ffb39 100644 --- a/pyserial/serial/serialposix.py +++ b/pyserial/serial/serialposix.py @@ -291,7 +291,7 @@ class PosixSerial(SerialBase): # open try: self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK) - except IOError, msg: + except OSError, msg: self.fd = None raise SerialException(msg.errno, "could not open port %s: %s" % (self._port, msg)) #~ fcntl.fcntl(self.fd, FCNTL.F_SETFL, 0) # set blocking |