I'm using Eclipse for my first codes in Python 2.7.3 running ubuntu
I'm bigginner at python and linux, also using module pythonwifi 0.3.1 .
That code shall scan frequencies in frequency_channel_map
and wifi.scan()
should retrieve an object with information that is listed in the for-loop
#!/usr/bin/python2
from pythonwifi.iwlibs import Wireless
frequency_channel_map = {
2412000000: "1",
2417000000: "2",
2422000000: "3",
2427000000: "4",
2432000000: "5",
2437000000: "6",
2442000000: "7",
2447000000: "8",
2452000000: "9",
2457000000: "10",
2462000000: "11",
2467000000: "12",
2472000000: "13",
2484000000: "14",
}
wifi = Wireless("wlan")
for ap in wifi.scan():
print "SSID: " + ap.essid
print "AP: "+ ap.bssid
print "Signal: " + str(ap.quality.getsignallevel())
print "Frequ: "+ str(ap.frequency.getfrequency())
print "Chanel :"+ frequency_channel_map.get(ap.frequency.getfrequency())
print "____"
and get that issue
Traceback (most recent call last):
File "/home/andreas/workspace/test/firstModule.py", line 22, in <module>
print wifi.commit()
File "/usr/local/lib/python2.7/dist-packages/pythonwifi.egg/pythonwifi/iwlibs.py", line 679, in commit
pythonwifi.flags.SIOCSIWCOMMIT)
File "/usr/local/lib/python2.7/dist-packages/pythonwifi.egg/pythonwifi/iwlibs.py", line 1028, in iw_set_ext
return self.iw_get_ext(ifname, operation, data)
File "/usr/local/lib/python2.7/dist-packages/pythonwifi.egg/pythonwifi/iwlibs.py", line 1023, in iw_get_ext
result = self._fcntl(request, ifreq)
File "/usr/local/lib/python2.7/dist-packages/pythonwifi.egg/pythonwifi/iwlibs.py", line 1010, in _fcntl
return fcntl.ioctl(self.sockfd.fileno(), request, args)
IOError: [Errno 1] Operation not permitted
I have no idea why it's occurre. Search since 2 days for IOError: [Errno 1] Operation not permitted
but found anything that I understand
PS. first post on stackoverflow, please be insightful
usually error;operation not permitted, occurs if you are not in root, i.e,make sure that you run this python script as root user, to do this. open up your linux terminal, and type sudo su. you ll get a prompt asking your password,this password is same as you use to login into linux. and then run your python code.