我刚刚在Mac OS Sierra上安装了Scapy(v 2.3.3)。 只要我连接到WiFi,它就能正常工作,但是当我在没有连接的情况下运行代码时会出现导入错误。
以下是错误陈述:
File "/usr/local/lib/python2.7/site-packages/scapy/all.py", line 25, in <module>
from scapy.route import *
File "/usr/local/lib/python2.7/site-packages/scapy/route.py", line 163, in <module>
conf.route=Route()
File "/usr/local/lib/python2.7/site-packages/scapy/route.py", line 22, in __init__
self.resync()
File "/usr/local/lib/python2.7/site-packages/scapy/route.py", line 31, in resync
self.routes = read_routes()
File "/usr/local/lib/python2.7/site-packages/scapy/arch/unix.py", line 102, in read_routes
ifaddr = scapy.arch.get_if_addr(netif)
File "/usr/local/lib/python2.7/site-packages/scapy/arch/__init__.py", line 48, in get_if_addr
return socket.inet_ntoa(get_if_raw_addr(iff))
File "/usr/local/lib/python2.7/site-packages/scapy/arch/pcapdnet.py", line 519, in get_if_raw_addr
return i.get(ifname)["addr"].data
KeyError: 'addr'