From 800eaa09156df905e349ee40d217066aa22297cc Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Mon, 2 May 2022 14:20:12 +0300 Subject: [PATCH] change makedirs --- image_classifier/image_classifier.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/image_classifier/image_classifier.py b/image_classifier/image_classifier.py index 68e4202..1040abd 100755 --- a/image_classifier/image_classifier.py +++ b/image_classifier/image_classifier.py @@ -110,12 +110,12 @@ class image_classifier: else: folder = 'unknown-time' new_path = os.path.join(dirname, folder, filename) - if not os.path.exists(os.path.join(dirname, folder)): + if not os.path.exists(os.path.dirname(new_path)): os.makedirs(os.path.dirname(new_path)) if self.people_folder: for person in people: person_path = os.path.join(self.people_folder, person, folder, filename) - if not os.path.exists(os.path.join(self.people_folder, person, folder)): + if not os.path.exists(os.path.dirname(person_path)): os.makedirs(os.path.dirname(person_path)) self._log.debug(f"Copying file '{file}' to '{person_path}'...") shutil.copy(file, person_path)