From ff0572c27664882133baf524313320be0ad5bba8 Mon Sep 17 00:00:00 2001 From: muddymudskipper Date: Fri, 21 Jun 2024 15:32:41 +0100 Subject: [PATCH] move temp file creation from init to get_graphs --- cmem_plugin_robotreason/plugin_robotreason.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmem_plugin_robotreason/plugin_robotreason.py b/cmem_plugin_robotreason/plugin_robotreason.py index fb64eeb..1ad6eec 100644 --- a/cmem_plugin_robotreason/plugin_robotreason.py +++ b/cmem_plugin_robotreason/plugin_robotreason.py @@ -108,8 +108,6 @@ def __init__( self.result_iri = result_iri self.reasoner = reasoner self.temp = f"robot_{uuid4().hex}" - if not Path(self.temp).exists(): - Path(self.temp).mkdir(parents=True) def create_xml_catalog_file(self, graphs: dict) -> None: """Create XML catalog file""" @@ -129,6 +127,8 @@ def create_xml_catalog_file(self, graphs: dict) -> None: def get_graphs(self, graphs: dict) -> None: """Get graphs from CMEM""" + if not Path(self.temp).exists(): + Path(self.temp).mkdir(parents=True) for graph in graphs: with (Path(self.temp) / graphs[graph]).open("w", encoding="utf-8") as file: file.write(get(graph).text)