From 0c8b17568c295c2db92a9487b8fd654737c0174e Mon Sep 17 00:00:00 2001 From: joda9 Date: Fri, 27 Sep 2024 14:40:05 +0200 Subject: [PATCH] Fix connect_to_lv_bus return type and error handling --- edisgo/network/topology.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/edisgo/network/topology.py b/edisgo/network/topology.py index 23c87aea..633c508f 100755 --- a/edisgo/network/topology.py +++ b/edisgo/network/topology.py @@ -2603,7 +2603,10 @@ def handle_voltage_level_7(): target_bus = self._connect_to_lv_bus( edisgo_object, lv_buses.distance.idxmin(), comp_type, comp_data ) - return target_bus, ModuleNotFoundError + if isinstance(target_bus, str): + return target_bus, None + elif isinstance(target_bus, pd.DataFrame): + return target_bus.index[0], None else: target_bus = lv_buses_masked.loc[lv_buses_masked.distance.idxmin()]