From 3d9ff3bb913e5701080c3acb2582843cf6f00056 Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Sun, 21 Jan 2024 18:25:24 +0100 Subject: [PATCH] Fix dropping of data on connection deletion --- src/tespy/networks/network.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tespy/networks/network.py b/src/tespy/networks/network.py index ee195af54..1fcf09011 100644 --- a/src/tespy/networks/network.py +++ b/src/tespy/networks/network.py @@ -454,7 +454,10 @@ def del_conns(self, *args): comps = list({cp for c in args for cp in [c.source, c.target]}) for c in args: self.conns.drop(c.label, inplace=True) - self.results["Connection"].drop(c.label, inplace=True) + if "Connection" in self.results: + self.results["Connection"].drop( + c.label, inplace=True, errors="ignore" + ) msg = ('Deleted connection ' + c.label + ' from network.') logger.debug(msg)