Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wifi-users.py : Error getting wireless interface #13

Open
sheepdestroyer opened this issue Feb 7, 2017 · 9 comments
Open

wifi-users.py : Error getting wireless interface #13

sheepdestroyer opened this issue Feb 7, 2017 · 9 comments

Comments

@sheepdestroyer
Copy link

[sheepdestroyer@sheepivyra FreeWifi]$ sudo python wifi-users.py 
Error getting wireless interface.
Traceback (most recent call last):
  File "wifi-users.py", line 161, in <module>
    main(argv)
  File "wifi-users.py", line 58, in main
    wireless = Wireless()
  File "/usr/lib/python2.7/site-packages/wireless/Wireless.py", line 23, in __init__
    self._driver_name = self._detectDriver()
  File "/usr/lib/python2.7/site-packages/wireless/Wireless.py", line 50, in _detectDriver
    compare = self.vercmp(ver, "0.9.9.0")
  File "/usr/lib/python2.7/site-packages/wireless/Wireless.py", line 71, in vercmp
    return cmp(normalize(actual), normalize(test))
  File "/usr/lib/python2.7/site-packages/wireless/Wireless.py", line 70, in normalize
    return [int(x) for x in re.sub(r'(\.0+)*$', '', v).split(".")]
ValueError: invalid literal for int() with base 10: '4-3'
[sheepdestroyer@sheepivyra FreeWifi]$ 

@spiritphyz
Copy link

spiritphyz commented Feb 9, 2017

Hi,

I'm getting similar errors, too (on macOS 10.12.2 and Python 2.7.12).

FreeWifi $ python wifi-users.py
Available interfaces: en1
Interface: en1
Error getting wireless interface.
Traceback (most recent call last):
  File "wifi-users.py", line 161, in <module>
    main(argv)
  File "wifi-users.py", line 68, in main
    ssid = wireless.current()
  File "/usr/local/lib/python2.7/site-packages/wireless/Wireless.py", line 79, in current
    return self._driver.current()
  File "/usr/local/lib/python2.7/site-packages/wireless/Wireless.py", line 427, in current
    self._interface))
  File "/usr/local/lib/python2.7/site-packages/wireless/Wireless.py", line 11, in cmd
    stdout=subprocess.PIPE, stderr=subprocess.STDOUT
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 23: ordinal not in range(128)

@tbodt
Copy link

tbodt commented Feb 10, 2017

Similar, but not the same.

@spiritphyz I would theorize that there are nearby wifi networks whose names have non-ascii characters.

@kylemcdonald
Copy link
Owner

kylemcdonald commented Feb 10, 2017

It looks like this is a bug in Wireless and it would be great if you could submit an issue in that repo.

I think @tbodt is correct, and that this is a bug with non-ASCII characters being evaluated by this regex https://github.com/joshvillbrandt/wireless/blob/master/wireless/Wireless.py#L70

If you could paste the name of your current wireless network here, it would probably help in debugging the issue. You can probably get the wireless name from Network Settings, but if not you can also use this in the Terminal:

$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I \
  | grep " SSID"
           SSID: FREE_WIFI

@sheepdestroyer
Copy link
Author

sheepdestroyer commented Feb 10, 2017

i'm in france so there's likely some accentuated network nearby, i'll try to do your check later

edit :
my bad, that does not apply to me as it fails at getting the wireless interface

@spiritphyz
Copy link

@tbodt @kylemcdonald Awesome! You guys are totally right -- my home WiFi network has non-ASCII Emoji in the network name:

$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I \
>   | grep " SSID"
           SSID: 🐳 Big Whale Network 

I don't have any problems with Unicode in the network name because all our devices are iOS or Mac, and the network name is displayed correctly during discovery.

Is it easy to change the regex to include Unicode?

@tbodt
Copy link

tbodt commented Feb 12, 2017

It's not a problem with the regex, it's a problem with the bare decode() at the top of the file. It should have 'utf-8' in it (or something).

@tbodt
Copy link

tbodt commented Feb 12, 2017

@sheepdestroyer your problem is also a problem with Wireless, but a different one. the version of nmcli has a hyphen in it which breaks the version detection.

@constantinedev
Copy link

constantinedev commented May 4, 2018

I think I have the simple problem with this following error
root@WalkerPi:/home/t/FreeWifi# python wifi-users.py -i wlx90f6520940c1
Traceback (most recent call last):
File "wifi-users.py", line 10, in <module>
from netaddr import EUI, mac_unix_expanded
ImportError: No module named netaddr
root@WalkerPi:/home/t/FreeWifi#
I don't know what means the EUI for? I have try the with tcpdump with the right USB...
and I'm running on Raspberry Pi Ubuntu Mate.
Should I modify the py file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@kylemcdonald @constantinedev @sheepdestroyer @tbodt @spiritphyz and others