From cbbaf735381cb0cebfafdd81ef779096938e4921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Thu, 20 Oct 2022 12:07:56 +0200 Subject: [PATCH] Fix bug EventedEnvironment --- soil/environment.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/soil/environment.py b/soil/environment.py index 926f26f..3a48d30 100644 --- a/soil/environment.py +++ b/soil/environment.py @@ -318,7 +318,9 @@ class EventedEnvironment(Environment): for agent in self.agents(**kwargs): self.logger.info(f'Telling {repr(agent)}: {msg} ttl={ttl}') try: - agent._inbox.append(events.Tell(payload=msg, sender=sender, expiration=expiration if ttl is None else self.now+ttl)) + inbox = agent._inbox except AttributeError: - self.info(f'Agent {agent.unique_id} cannot receive events') + self.logger.info(f'Agent {agent.unique_id} cannot receive events because it does not have an inbox') + continue + inbox.append(events.Tell(payload=msg, sender=sender, expiration=expiration if ttl is None else self.now+ttl))