diff --git a/src/python/antares_xpansion/config_loader.py b/src/python/antares_xpansion/config_loader.py index f533e00d9..7330b4736 100644 --- a/src/python/antares_xpansion/config_loader.py +++ b/src/python/antares_xpansion/config_loader.py @@ -504,6 +504,9 @@ def _set_last_simulation_name(self): self._last_study = self.last_modified_study(self.antares_output()) self._set_xpansion_simulation_name() + class NotAnXpansionOutputDir(Exception): + pass + def _set_xpansion_simulation_name(self): if self.step() in ["resume", "sensitivity"] : @@ -512,6 +515,11 @@ def _set_xpansion_simulation_name(self): self._xpansion_simulation_name = self._last_study.parent / self._last_study.stem with zipfile.ZipFile(self._last_study, 'r') as output_zip: output_zip.extractall(self._xpansion_simulation_name) + elif self.step() == "benders": + if(not self._last_study.name.endswith("-Xpansion")): + raise ConfigLoader.NotAnXpansionOutputDir(f"Error! {self._last_study} is not an Xpansion output directory") + self._xpansion_simulation_name = self._last_study + else: self._xpansion_simulation_name = self._last_study.parent / \ (self._last_study.stem+"-Xpansion")