2015-09-17 16 views
2

Вот мой код:Python 3.4.3 - Ошибка Pyshark capture.sniff()

import pyshark 
capture = pyshark.LiveCapture(interface='en0') 
capture.sniff() 

Теперь вот ошибка:

Traceback (most recent call last): 
File "<pyshell#2>", line 1, in <module> 
capture.sniff() 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/capture/capture.py", line 109, in load_packets 
self.apply_on_packets(keep_packet, timeout=timeout) 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/capture/capture.py", line 201, in apply_on_packets 
return self.eventloop.run_until_complete(coro) 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/trollius/base_events.py", line 350, in run_until_complete 
return future.result() 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/trollius/futures.py", line 286, in result 
raise self._exception 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/trollius/tasks.py", line 250, in _step 
result = coro.throw(exc) 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/capture/capture.py", line 212, in packets_from_tshark 
tshark_process = yield From(self._get_tshark_process(packet_count=packet_count)) 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/trollius/tasks.py", line 252, in _step 
result = coro.send(value) 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/capture/capture.py", line 298, in _get_tshark_process 
parameters = [get_tshark_path(self.tshark_path), '-l', '-n', '-T', xml_type] + self.get_parameters(packet_count=packet_count) 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/tshark/tshark.py", line 93, in get_tshark_path 
'Search these paths: {}'.format(possible_paths) 
pyshark.tshark.tshark.TSharkNotFoundException: TShark not found. Try adding its location to the configuration file. Search these paths: ['C:\\Program Files\\Wireshark\\tshark.exe', '/usr/bin/tshark', '/bin/tshark', '/usr/sbin/tshark', '/sbin/tshark'] 

Я бегу Mac OS 10.10.x с питоном 3.4.3 Установленный pyshark с sudo pip3 install pyshark

ответ

1

Попробуйте установить tshark, который работал на меня, и я на Ubuntu linux.

sudo apt-get install TShark 

Благословения.

+0

Я нахожусь на mac: p (написано в описании). В любом случае спасибо! –

+0

Большое спасибо за это решение Linux! сделал мой день :) – another