信号处理程序必须是signal.SIG_IGN,signal.SIG_DFL或可调用对象

时间:2019-05-09 12:41:05

标签: python pyshark

我正在尝试编写一些代码以使用python执行某些数据包嗅探 使用pyshark。我有以下代码:

import pyshark
print('Pyshark demo')
capture = pyshark.LiveCapture(interface='enp0s8')

但是,当我尝试运行此脚本时,会得到以下堆栈跟踪:

Pyshark demo
Exception ignored in: <bound method BaseEventLoop.__del__ of <_UnixSelectorEventLoop running=False closed=True debug=False>>
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/base_events.py", line 431, in __del__
  File "/usr/lib/python3.5/asyncio/unix_events.py", line 58, in close
  File "/usr/lib/python3.5/asyncio/unix_events.py", line 139, in remove_signal_handler
  File "/usr/lib/python3.5/signal.py", line 47, in signal
TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object

我已经安装了pyshark。您知道导致此问题的原因吗?

我在ubuntu服务器16.04上运行它