summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2011-08-19 23:43:10 +0000
committercliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2011-08-19 23:43:10 +0000
commit7b2fab365ecf534b80347dcc8e9a872b1c25d111 (patch)
tree27e41d12f1d2052714af0eb9f8ff9312f33c69ee
parent01008c17aa5126059ef765ff86cc667b5f209569 (diff)
downloadpyserial-7b2fab365ecf534b80347dcc8e9a872b1c25d111.tar.gz
fix exception type not found and only grep through list if it starts with hwgrep:// otherwise exhibit native port behavior
git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@418 f19166aa-fa4f-0410-85c2-fa1106f25c8a
-rw-r--r--serial/urlhandler/protocol_hwgrep.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/serial/urlhandler/protocol_hwgrep.py b/serial/urlhandler/protocol_hwgrep.py
index 7b90761..62cda43 100644
--- a/serial/urlhandler/protocol_hwgrep.py
+++ b/serial/urlhandler/protocol_hwgrep.py
@@ -19,7 +19,7 @@ class Serial(serial.Serial):
def setPort(self, value):
"""translate port name before storing it"""
- if isinstance(value, basestring):
+ if isinstance(value, basestring) and value.startswith('hwgrep://'):
serial.Serial.setPort(self, self.fromURL(value))
else:
serial.Serial.setPort(self, value)
@@ -31,7 +31,7 @@ class Serial(serial.Serial):
for port, desc, hwid in serial.tools.list_ports.grep(url):
return port
else:
- raise SerialException('no ports found matching regexp %r' % (url,))
+ raise serial.SerialException('no ports found matching regexp %r' % (url,))
# override property
port = property(serial.Serial.getPort, setPort, doc="Port setting")