summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2013-10-10 23:57:00 +0000
committercliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2013-10-10 23:57:00 +0000
commitaf84daa654c8168874de37340a92ec8db7d74426 (patch)
tree5a32355f8ad8d1ad3bc3c06ef80309cd3ff7607c
parent387251a3744ff6d116fa5652bdd120b8a8424143 (diff)
downloadpyserial-git-af84daa654c8168874de37340a92ec8db7d74426.tar.gz
[Bug pyserial:141] open: Pass errno from IOError to SerialException
-rw-r--r--pyserial/CHANGES.txt1
-rw-r--r--pyserial/serial/serialposix.py4
2 files changed, 3 insertions, 2 deletions
diff --git a/pyserial/CHANGES.txt b/pyserial/CHANGES.txt
index 0136145..0c07e3f 100644
--- a/pyserial/CHANGES.txt
+++ b/pyserial/CHANGES.txt
@@ -456,6 +456,7 @@ Bugfixes (posix):
- list_ports and device() for BSD updated (Anders Langworthy)
- [Bug 3518380] python3.2 -m serial.tools.list_ports error
- [Bug pyserial:137] Patch to add non-standard baudrates to Cygwin
+- [Bug pyserial:141] open: Pass errno from IOError to SerialException
Bugfixes (win32):
diff --git a/pyserial/serial/serialposix.py b/pyserial/serial/serialposix.py
index 1b7fe86..27c1328 100644
--- a/pyserial/serial/serialposix.py
+++ b/pyserial/serial/serialposix.py
@@ -288,9 +288,9 @@ class PosixSerial(SerialBase):
# open
try:
self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
- except Exception, msg:
+ except IOError, msg:
self.fd = None
- raise SerialException("could not open port %s: %s" % (self._port, msg))
+ raise SerialException(msg.errno, "could not open port %s: %s" % (self._port, msg))
#~ fcntl.fcntl(self.fd, FCNTL.F_SETFL, 0) # set blocking
try: