awkman / pywifi

A cross-platform module for manipulating WiFi devices.
MIT License
447 stars 154 forks source link

Unable to connect to a encrypted network #19

Closed ZheyuanXie closed 5 years ago

ZheyuanXie commented 6 years ago
profile=pywifi.Profile()
profile.ssid="apssid"

iface.remove_all_network_profiles()
tmp_profile=iface.add_network_profile(pf)
iface.connect(tmp_profile)

I got this and when iface.connect(tmp_profile) gets executed.

AttributeError: 'NoneType' object has no attribute 'ssid'

it seems the add_network_profile method is returning a NoneType object instead of a profile object, is there anything wrong with my code? Thanks

awkman commented 6 years ago

@ZheyuanXie Yes, if the AP is no security mode, the profile will not be returned in the add_network_profile() call. I fix this issue by 521b143