From 96a7d07bca6dba459d32791872d18e7acd05a1df Mon Sep 17 00:00:00 2001 From: Adam Blackburn Date: Sat, 20 Jun 2009 13:42:21 -0500 Subject: [PATCH] return 101 as the signal strength if altstrenth_pattern fails to find the strength --- wicd/wnettools.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wicd/wnettools.py b/wicd/wnettools.py index 65a2018..ac6d1c8 100644 --- a/wicd/wnettools.py +++ b/wicd/wnettools.py @@ -1366,7 +1366,14 @@ class BaseWirelessInterface(BaseInterface): (strength, max_strength) = (None, None) if strength in ['', None]: - [(strength, max_strength)] = altstrength_pattern.findall(output) + try: + [(strength, max_strength)] = altstrength_pattern.findall(output) + except ValueError: + # if the pattern was unable to match anything + # we'll return 101, which will allow us to stay + # connected even though we don't know the strength + # it also allows us to tell if + return 101 if strength not in ['', None] and max_strength: return (100 * int(strength) // int(max_strength)) elif strength not in ["", None]: