Folks, I'm confused.
It is a complicated flow so I won't post it.
This is a python script I am running to scan for visible WAPs.
#wifiscan.py
import subprocess
import json
import re
child = subprocess.Popen('sudo iwlist wlan0 scan | grep -B 2 ESSID',shell=True,stdout=subprocess.PIPE)
output = child.communicate()[0]
output = output.decode("utf8")
output = output.replace(' ESSID:','')
output = output.replace(' "','')
output = output.replace('"','')
output = output.splitlines()
output = json.dumps(output)
print (output)
and ideally I should get this back:
[" Quality=70/70 Signal level=-37 dBm ", " Encryption key:on", "Marys_Farm_2.4", "", "", "--", " Quality=70/70 Signal level=-32 dBm ", " Encryption key:on", "Marys_Farm_2.4", "--", " Quality=35/70 Signal level=-75 dBm ", " Encryption key:on", "Vodafone5G-A4998", "--", " Quality=41/70 Signal level=-69 dBm ", " Encryption key:on", "Vodafone2.4G-A4998", "--", " Quality=34/70 Signal level=-76 dBm ", " Encryption key:on", "MyRepublic 49D9", "--", " Quality=36/70 Signal level=-74 dBm ", " Encryption key:on", "FSF_Common Area", "--", " Quality=60/70 Signal level=-50 dBm ", " Encryption key:on", "Marys_Farm_5", "--", " Quality=56/70 Signal level=-54 dBm ", " Encryption key:on", "...
It is run about every 40
seconds.
But now and then I get this on it's output:
[]
Not good.
Any ideas what is going on and causing the empty array to be sent?
And at worst, if it is going to send []
rather it sends a message like: something went wrong
.