From c40557695fd17ecafc77adc5177c9eb19e5920ec Mon Sep 17 00:00:00 2001 From: Darryl Lee Date: Wed, 24 Feb 2016 22:45:45 -0800 Subject: [PATCH] Fix when Quality = '' Some APs are returning Quality values of single integers instead of x/100. I'm not sure why, but getCellQuality doesn't seem to recognize a single integer, and so Quality ends up being set to '', per the default value set in line 157. Unfortunately, when sortNetworks then tries to figure out a sorting factor, it assumes there will be a slash, and we get the error: Unhandled exception 'need more than 1 value to unpack' at /usr/lib/python2.7/dist-packages/kano/network.py line 225 I couldn't figure out why getCellQuality isn't able to deal with a single integer Quality, but I was able to workaround these weird APs (luckily neither of them is mine) by setting factor to 0 if Quality = ''. --- kano/network.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kano/network.py b/kano/network.py index 8c87589..ab589cd 100755 --- a/kano/network.py +++ b/kano/network.py @@ -221,8 +221,11 @@ def getList(self, unsecure=False, first=False, debug=False): ''' def sortNetworks(adict): - x, z = adict['quality'].split('/') - factor = int(x) / float(z) + if adict['quality'] != '': + x, z = adict['quality'].split('/') + factor = int(x) / float(z) + else: + factor = 0 return factor def add_wnet(wlist, new_wnet):