I have been search for a couple of hours to find a a tutorial on how to show the list of available networks and connect to a network programmatically.I don't want to use command line. I have installed python wifi module but there is no tutorial on how to use it programmatically.

  • What is wrong with the tool included in the GUI? – Milliways Jan 9 '20 at 11:37
  • I want to show the list of networks in a local webpage. – smc Jan 9 '20 at 11:39
  • @ShyamMohan, it's a programming question not a question related to RaspberryPi , i think that's why someone downvoted you. Next time try using stackoverflow for example. – Ephemeral Jan 9 '20 at 11:50

From here

# python2.7
>>> from pythonwifi.iwlibs import Wireless
>>> wifi = Wireless('wlan')
>>> wifi.getEssid()
>>> wifi.getMode()

And here

def scan(self):
    """ Returns Iwscanresult objects, after a successful scan. """
    return Iwscan(self.ifname)


# python2.7
>>> from pythonwifi.iwlibs import Wireless
>>> wifi = Wireless('wlan')
>>> wifi.scan()

must work.

You can try to find python lib for specific version using the filters on the PyPI webpage, for example

  • I'm getting this erron when using 'from pythonwifi.iwlibs import Wireless` Traceback (most recent call last): File "showMap.py", line 59, in <module> from pythonwifi.iwlibs import Wireless File "/usr/local/lib/python3.5/dist-packages/pythonwifi/iwlibs.py", line 113 except IOError, (errno, strerror): ^ SyntaxError: invalid syntax – smc Jan 9 '20 at 11:15
  • Seems not compatible with python 3.5 – smc Jan 9 '20 at 11:16
  • @ShyamMohan, it's work with python2.7 for example ? – Ephemeral Jan 9 '20 at 11:17
  • 2
    Yeah it's working with python2.7. but I'm using python 3.5 – smc Jan 9 '20 at 11:19
  • 1
    I just found this stackoverflow.com/questions/38190545/… – smc Jan 9 '20 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.