OSX PyShark:运行时警告:从未等待协程'wait_for'

时间:2018-09-12 13:50:03

标签: python-3.x macos macos-high-sierra tshark pyshark

我想知道周围的人是否可能知道导致此问题的原因。在运行使用pyshark库的python脚本时,我在OSX High Sierra上始终收到此错误。

我正在跑步

  • Tshark 2.6.2
  • Python 3.7.0
  • PyShark 0.4.1

错误:

/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))

我的代码:

#!/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)

使用sudo执行脚本不起作用。而且我能够在不使用sudo命令的情况下运行TShark,所以我认为这也不应该是一个问题。我还启动了XCode,以检查是否需要提交任何协议或其他东西,不是这种情况。

0 个答案:

没有答案