From 6e1824b19377bc445ccf04df74374455fbfc07bc Mon Sep 17 00:00:00 2001
From: Olegs NIKISINS <onikisins@italix03.idiap.ch>
Date: Mon, 12 Mar 2018 18:09:52 +0100
Subject: [PATCH] Updated annotatoins in BATL HLDI

---
 bob/pad/face/database/batl.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bob/pad/face/database/batl.py b/bob/pad/face/database/batl.py
index fe44953d..98db4eec 100644
--- a/bob/pad/face/database/batl.py
+++ b/bob/pad/face/database/batl.py
@@ -270,7 +270,10 @@ class BatlPadDatabase(PadDatabase):
 
             if self.annotations_temp_dir: # if directory is not an empty string
 
-                with open(file_path, 'w') as json_file:
+                if not os.path.exists( os.path.split(file_path)[0] ):
+                    os.makedirs( os.path.split(file_path)[0] )
+
+                with open(file_path, 'w+') as json_file:
 
                     json_file.write(json.dumps(annotations))
 
-- 
GitLab