报错内容:
pyshark.tshark.tshark.TSharkNotFoundException: TShark not found. Try adding its location to the configuration file. Searched these paths: ['C:\\Program Files\\Wireshark\\tshark.exe', 'C:\\Program Files (x86)\\Wireshark\\tshark.exe', 'C:\\Program Files\\Wireshark\\tshark.exe']
出现该报错的主要原因是因为没有找到tshark.exe
,没找到这个是因为你的wireshark没有安装在默认路径,如果重新安装比较麻烦,我们可以去修改config.ini
中的tshark.exe
的路径。
config.ini
路径在python安装路径的\Lib\site-packages\pyshark
中
修改前,我们先把原版备份一下,以备不时之需!
原版:
[tshark]
# Specify the path to the tshark executable.
# If the configured path does not exist, these locations will be searched:
# (Linux): /usr/bin/tshark
# (Linux): /usr/sbin/tshark
# (Linux): /usr/lib/tshark/tshark
# (Linux): /usr/local/bin/tshark
# (Windows): %ProgramFiles%\Wireshark\tshark.exe
# (Windows): %ProgramFiles(x86)%\Wireshark\tshark.exe
tshark_path = C:\Program Files\Wireshark\tshark.exe
[dumpcap]
dumpcap_path = C:\Program Files\Wireshark\dumpcap.exe
修改后:
简单的代码终于没有出现问题了
希望能解决大家的问题,拜拜!!!!!!!!!!!!!!