implementing pyshark

Peter Otten __peter__ at web.de
Mon Apr 6 14:11:00 CEST 2015


Michael S. wrote:

> Hi everyone. while trying to implement pyshark, i am getting this error:
>         import pyshark
>        capture = pyshark.LiveCapture(interface='wlan0')
>        capture.sniff(timeout=50)
>        capture
> i have tried also to run it through interpreter yet, i got this error:
> import pyshark
> 
---------------------------------------------------------------------------
> ImportError                               Traceback (most recent call
> last) <ipython-input-1-e46ddf42872e> in <module>()
> ----> 1 import pyshark
> 
> /usr/local/lib/python2.7/dist-packages/pyshark-0.3.4-
py2.7.egg/pyshark/__init__.py
> in <module>()
> ----> 1 from pyshark.capture.live_capture import LiveCapture
>        2 from pyshark.capture.file_capture import FileCapture
>        3 from pyshark.capture.remote_capture import RemoteCapture
>        4 from pyshark.capture.inmem_capture import InMemCapture
> 
> /usr/local/lib/python2.7/dist-packages/pyshark-0.3.4-
py2.7.egg/pyshark/capture/live_capture.py
> in <module>()
> ----> 1 from pyshark.capture.capture import Capture
>        2 from pyshark.tshark.tshark import get_tshark_interfaces
>        3
>        4
>        5 class LiveCapture(Capture):
> 
> /usr/local/lib/python2.7/dist-packages/pyshark-0.3.4-
py2.7.egg/pyshark/capture/capture.py
> in <module>()
>        1 from __future__ import unicode_literals
>        2 import os
> ----> 3 import logbook
>        4 import sys
>        5
> 
> /usr/local/lib/python2.7/dist-packages/logbook/__init__.py in <module>()
>       12
>       13
> ---> 14 from logbook.base import LogRecord, Logger, LoggerGroup,
> NestedSetup, \
>       15      Processor, Flags, get_level_name, lookup_level,
> dispatch_record, \
>       16      CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG, NOTSET, \
> 
> /usr/local/lib/python2.7/dist-packages/logbook/base.py in <module>()
>       16 from datetime import datetime
>       17 from logbook import helpers
> ---> 18 from logbook.concurrency import thread_get_name,
> thread_get_ident, greenlet_get_ident
>       19
>       20 from logbook.helpers import to_safe_json, parse_iso8601,
> cached_property, \
> 
> /usr/local/lib/python2.7/dist-packages/logbook/concurrency.py in
> <module>()
>       29
>       30 if has_gevent:
> ---> 31     from gevent._threading import (Lock as ThreadLock,
>       32                                    RLock as ThreadRLock,
>       33                                    get_ident as thread_get_ident,
> 
> ImportError: No module named _threading
> 
> i tried importing threading first and importing pyshark, but the answer
> was the same.
> any suggestions?

Line 30 suggests that pyshark assumes that gevent is installed while line 31 
indicates that gevent is not installed correctly.

So do you have an incomplete install of gevent? Either remove it or replace 
it with a working one, i. e.

import gevent
import gevent._threading

should either both fail or both succeed.




More information about the Python-list mailing list