OSX PyShark: RuntimeWarning: coroutine 'wait_for' was never awaited

醉酒当歌 提交于 2019-12-24 02:14:58

问题


I was wondering if anyone around here might know what causes this issue. I keep getting this error on OSX High Sierra, while running a python script which uses the pyshark library.

I am running

  • Tshark 2.6.2
  • Python 3.7.0
  • PyShark 0.4.1

The error:

/usr/local/lib/python3.7/site-packages/pyshark-0.4.1-py3.7.egg/pyshark/capture/capture.py:230: RuntimeWarning: coroutine 'wait_for' was never awaited
  self.eventloop.run_until_complete(self._cleanup_subprocess(tshark_process))
/usr/local/lib/python3.7/site-packages/pyshark-0.4.1-py3.7.egg/pyshark/capture/capture.py:230: RuntimeWarning: coroutine 'Process.wait' was never awaited
  self.eventloop.run_until_complete(self._cleanup_subprocess(tshark_process))

My code:

#!/usr/bin/env python3

import pyshark

def capture(iface, tout):
    cap = pyshark.LiveCapture(interface=iface);
    cap.set_debug()
    cap.sniff(timeout=10)

    for packet in cap.sniff_continuously(packet_count=5):
        print('Just arrived:', packet)


capture('en7', 50)

Executing the script using sudo does not work. And I am able to run TShark without the sudo command so that should not be an issue as well I suppose. I also started XCode to check if I needed to submit any agreement or something, which wasn't the case.

来源:https://stackoverflow.com/questions/52296797/osx-pyshark-runtimewarning-coroutine-wait-for-was-never-awaited

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!