From 4a0fe66571b4036b321d1192fcb8e4faebd66a4f Mon Sep 17 00:00:00 2001 From: Balthasar Reuter Date: Fri, 29 May 2015 00:31:00 +0200 Subject: [PATCH] Directory is now created --- photobooth.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/photobooth.py b/photobooth.py index 2544b22..53f2692 100755 --- a/photobooth.py +++ b/photobooth.py @@ -3,6 +3,7 @@ from __future__ import division +import os import subprocess from datetime import datetime from glob import glob @@ -57,6 +58,10 @@ class Images: self.basename = basename self.suffix = ".jpg" self.count_width = 5 + # Ensure directory exists + dirname = os.path.dirname(self.basename) + if not os.path.exists(dirname): + os.makedirs(dirname) # Find existing files count_pattern = "[0-9]" * self.count_width pictures = glob(self.basename + count_pattern + self.suffix)