Scapy と Volttron を組み合わせており、パケットが入ってきて特定の機能があるときにトピックに公開したいと考えています。ただし、次のエラーが発生し続けます。
トレースバック (最新の呼び出しが最後): ファイル "sniff.py"、373 行目、sys.exit(main()) ファイル "sniff.py"、342 行目、メイン utils.vip_main(sniffer, version= version ) ファイル"/home/jenny/workspace/volttron/volttron/platform/agent/utils.py",
314 行目、vip_main version=version, **kwargs) ファイル「sniff.py」、336 行目、sniffer Sniffer(**kwargs) ファイル「sniff.py」、138 行目、init self.vip.pubsub.publish ('pubsub', "some/topic", message="blah")
ファイル "/home/jenny/workspace/volttron/volttron/platform/vip/agent/subsystems/pubsub.py",602 行目、publish self._save_parameters(result.ident, **kwargs)
ファイル「/home/jenny/workspace/volttron/volttron/platform/vip/agent/subsystems/pubsub.py」、706 行目、_save_parameters イベント = self.core().schedule(end_time, self._cancel_event, result_id)
ファイル「/home/jenny/workspace/volttron/volttron/platform/vip/agent/core.py」、409 行目、スケジュール self._schedule_callback(deadline) 、イベント) ファイル「/home/jenny/workspace/volttron/volttron/platform/vip/agent/core.py」、417 行目、_schedule_callback self._schedule_event.set() 内AttributeError: 'NoneType' オブジェクトには属性 'set' がありません
私が見つけた解決策に最も近いのは、RPC crashes with AttributeError: 'NoneType' object has no attribute 'call'です。ただし、それらはまったく同じ問題ではないことに気付いたので、そこで提供された解決策を試してみても、それほど驚くことではありませんでした。
私のコードは次のようになります。
def sniffer(config_path, **kwargs):
''' Initializations '''
global pkt_counter
global IP_counter
# Defined other parameters here
class Sniffer(Agent):
def __init__(self, **kwargs):
super(Sniffer, self).__init__(**kwargs)
# I am just testing the publish function here
self.vip.pubsub.publish('pubsub', "some/topic", message="blah")
sniff(count=0, iface=conf.iface, prn = self.pkt_action, store=0)
def pkt_action(self, pkt):
#Process every packet, updates values and rises and alert if necessary
# some checks are run here and later a publish is called
誰かが私が間違っていることを教えてもらえますか?
編集:ターミナルで単純なpythonスクリプト(例:python somescript.py)を実行するので、このスクリプトを実行したいことを追加しませんでした:インストールなし。これを実行しようとしている理由は、エージェントをインストールして開始するとエラーが発生するためです。このプラットフォームでは、Scapy がソケットを作成して接続することを許可していません。