wifi: Scheme.for_cell 失败并出现 TypeError

wifi: Scheme.for_cell fails with TypeError

使用 wifi 包,这是我所做的:

>>> cell = Cell.all('wlan0')[0]
>>> print cell
>>> scheme = Scheme.for_cell('wlan0', 'home', cell)

当我打印 cell 时,它会打印 ssid。当我运行scheme = Scheme.for_cell('wlan0', 'home', cell)。它给出了错误

>>> scheme = Scheme.for_cell('wlan0', 'home', cell)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/aaeronn/virt_proj/wifi_hack/local/lib/python2.7/site-packages/wifi/scheme.py", line 110, in for_cell
    return cls(interface, name, configuration(cell, passkey))
  File "/home/aaeronn/virt_proj/wifi_hack/local/lib/python2.7/site-packages/wifi/scheme.py", line 23, in configuration
    if len(passkey) != 64:
TypeError: object of type 'NoneType' has no len()

怎么了?我应该在哪里输入那个 ssid 的密码?

documentation for wifi.Scheme.for_cell 说它需要一个 passkey 参数:

classmethod for_cell(interface, name, cell, passkey=None)

所以对于一些 passkey,你会调用

scheme = Scheme.for_cell('wlan0', 'home', cell, passkey)

查看 source code for that package,提出的 TypeError 存在错误,或者至少是仓促设计的迹象。