Search code examples
macospython-3.xpyshark

install pyshark on python 3.5


I've installed python 3.5 on mac os x (el capitan). I want to import pyshark module in python, but I get error. I installed the pyshark requirement such as (logbook, lxml, trollies, py) but I couldn't import pyshark module.

pip3 list >>
syncio (3.4.3)
futures (3.0.3)
Logbook (0.12.3)
lxml (3.5.0)
pip (7.1.2)
py (1.4.30)
pyshark (0.3.6)
setuptools (18.2)
trollius (2.0)

Importing pyshark module error:

>>> import pyshark
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyshark/__init__.py", line 1, in <module>
    from pyshark.capture.live_capture import LiveCapture
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyshark/capture/live_capture.py", line 1, in <module>
    from pyshark.capture.capture import Capture
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyshark/capture/capture.py", line 6, in <module>
    import trollius as asyncio
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/__init__.py", line 21, in <module>
    from .base_events import *
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/base_events.py", line 39, in <module>
    from . import coroutines
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/coroutines.py", line 15, in <module>
    from . import futures
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/futures.py", line 116, in <module>
    class Future(object):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/futures.py", line 426, in Future
    __await__ = __iter__ # make compatible with 'await' expression
NameError: name '__iter__' is not defined

Also importing trollies module has a error:

>>> import trollius
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/__init__.py", line 21, in <module>
    from .base_events import *
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/base_events.py", line 39, in <module>
    from . import coroutines
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/coroutines.py", line 15, in <module>
    from . import futures
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/futures.py", line 116, in <module>
    class Future(object):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/futures.py", line 426, in Future
    __await__ = __iter__ # make compatible with 'await' expression
NameError: name '__iter__' is not defined

Could any one help me out? I can't figure out what is the problem.


Solution

  • This is reported as a bug in https://github.com/haypo/trollius/issues/4

    Until it is resolved you can temporalily resolve it by installing an unofficial development version from ludios by doing:

    pip install -U git+https://github.com/ludios/trollius@f757a29815c2c9f5c3a691135ff758649fe84098#egg=trollius
    

    Remember that this is a temporary and unofficial solution only. So hit the "subscribe" button on the issue page: https://github.com/haypo/trollius/issues/4 to subscribe to notifications. When the issue is officially resolved, use the official solution.