From 642516a3a62b39e1cef55942b47a6b1e24f03dab Mon Sep 17 00:00:00 2001 From: BazettFraga Date: Thu, 9 Feb 2023 18:32:23 +0100 Subject: [PATCH] create output dir if none is present --- nodes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nodes.py b/nodes.py index 23b39829..12f4b639 100644 --- a/nodes.py +++ b/nodes.py @@ -493,6 +493,9 @@ class SaveImage: counter = max(filter(lambda a: a[1][:-1] == filename_prefix and a[1][-1] == "_", map(map_filename, os.listdir(self.output_dir))))[0] + 1 except ValueError: counter = 1 + except FileNotFoundError: + os.mkdir(self.output_dir) + counter = 1 for image in images: i = 255. * image.cpu().numpy() img = Image.fromarray(i.astype(np.uint8))