From 71aedf22da47ba86540045e4ef3e1bcf51ca37d1 Mon Sep 17 00:00:00 2001
From: cmoineau <cyril.moineau@cea.fr>
Date: Tue, 29 Oct 2024 08:55:37 +0000
Subject: [PATCH] Explicit error if template file is not present.

---
 aidge_core/export_utils/code_generation.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/aidge_core/export_utils/code_generation.py b/aidge_core/export_utils/code_generation.py
index 995df18b5..4f0f4634d 100644
--- a/aidge_core/export_utils/code_generation.py
+++ b/aidge_core/export_utils/code_generation.py
@@ -19,6 +19,8 @@ def generate_file(file_path: Union[Path, str], template_path: Union[Path, str],
         file_path = Path(file_path)
     if isinstance(template_path, str):
         template_path = Path(template_path)
+    if not template_path.exists():
+        raise ValueError(f"Path to template {template_path} is not valid !")
     # Make dir
     file_path.parent.mkdir(parents=True, exist_ok=True)
 
-- 
GitLab