我尝试像python3-wifi一样使用模块python3-wifi,但是对于当前的wifi-ssid和Mac地址,它是python3版本,但是我得到了以下错误:
这段代码我正在尝试
from pythonwifi.iwlibs import Wireless
wifi = Wireless("wlp3s0")
wifi.getEssid() #wifi-ssid
wifi.getAPaddr() #mac addresspython3 3-wifi模块我试过:https://github.com/llazzaro/python3-wifi
这个错误我得到了
File "/usr/local/lib/python3.6/dist-packages/pythonwifi/iwlibs.py", line 278, in getEssid
File "/usr/local/lib/python3.6/dist-packages/pythonwifi/iwlibs.py", line 789, in getEssid
File "/usr/local/lib/python3.6/dist-packages/pythonwifi/iwlibs.py", line 1220, in __init__
TypeError: cannot use a str to initialize an array with typecode 'c'是模块错误吗?因为我正确地跟踪了模块的代码,如果是模块错误,有人能告诉我应该使用哪些模块,比如获取当前的ssid、mac、ip和网关吗?谢谢之前..。
发布于 2018-08-28 13:47:05
这是链接模块中的一个错误。“c”标志显然已从“数组”类中删除。将来自python 2.7的文档与用于python 3.6的文档进行比较,不再存在用于char的'c'标志,只保留b和B。
查看链接的github的提交历史表明,代码是从其他地方克隆的,从python-wifi重命名为python3-wifi,没有进行任何重大更改,然后再也没有修改(自2年以来),因此代码可能没有完全移植。您可以自己尝试开始发行或修复代码,当您在"/usr/local/lib/python3.6/dist-packages/pythonwifi/iwlibs.py", line 1220, in __init__中用B替换c时,它可能已经起作用了。
https://stackoverflow.com/questions/52059220
复制相似问题