From 5819ab60e091f2dcb6bb83d0956228fddef93065 Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Mon, 13 Dec 2010 19:49:24 -0500 Subject: [PATCH] Fix for optimize-img with spaces in the output_dir --- optimizeimages.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/optimizeimages.py b/optimizeimages.py index 7bb35a3..6fe8b78 100644 --- a/optimizeimages.py +++ b/optimizeimages.py @@ -36,14 +36,14 @@ def optimize_image(imgpath, imgformat, optimizeimg): # we can't do an atomic replace here because windows is terrible # so instead, we make temp files, delete the old ones, and rename # the temp files. go windows! - subprocess.Popen(shlex.split(pngcrush +" " + imgpath + " " + imgpath + ".tmp"), + subprocess.Popen([pngcrush, imgpath, imgpath + ".tmp"], stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0] os.remove(imgpath) os.rename(imgpath+".tmp", imgpath) if optimizeimg >= 2: - subprocess.Popen(shlex.split(optipng + " " + imgpath), stderr=subprocess.STDOUT, + subprocess.Popen([optipng, imgpath], stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0] - subprocess.Popen(shlex.split(advdef + " -z4 " + imgpath), stderr=subprocess.STDOUT, + subprocess.Popen([advdef, "-z4",imgpath], stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0]