From 088dd4e0d2450204eb6ae82066805138f0ad38fc Mon Sep 17 00:00:00 2001 From: Saul Field Date: Wed, 7 Dec 2022 16:46:05 -0500 Subject: [PATCH 1/2] Suppress traci error during simulation step --- smarts/core/sumo_traffic_simulation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smarts/core/sumo_traffic_simulation.py b/smarts/core/sumo_traffic_simulation.py index 9212a5aecd..39abce3522 100644 --- a/smarts/core/sumo_traffic_simulation.py +++ b/smarts/core/sumo_traffic_simulation.py @@ -466,7 +466,8 @@ def _step(self, dt): # we tell SUMO to step through dt more seconds of the simulation self._cumulative_sim_seconds += dt try: - self._traci_conn.simulationStep(self._cumulative_sim_seconds) + with suppress_output(stderr=False): + self._traci_conn.simulationStep(self._cumulative_sim_seconds) except self._traci_exceptions as e: self._handle_traci_disconnect(e) return ProviderState() From 4915a92380089d120b48ea956a003cc41ec8f07d Mon Sep 17 00:00:00 2001 From: Saul Field Date: Wed, 7 Dec 2022 16:49:17 -0500 Subject: [PATCH 2/2] Add comment --- smarts/core/sumo_traffic_simulation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/smarts/core/sumo_traffic_simulation.py b/smarts/core/sumo_traffic_simulation.py index 39abce3522..63305debb2 100644 --- a/smarts/core/sumo_traffic_simulation.py +++ b/smarts/core/sumo_traffic_simulation.py @@ -466,6 +466,9 @@ def _step(self, dt): # we tell SUMO to step through dt more seconds of the simulation self._cumulative_sim_seconds += dt try: + # Suppress errors here, to avoid a known (and likely benign) + # error related to removing vehicles. + # See: https://github.com/huawei-noah/SMARTS/issues/1155 with suppress_output(stderr=False): self._traci_conn.simulationStep(self._cumulative_sim_seconds) except self._traci_exceptions as e: