From 09ba5560d8a94dc2f633e7bc11df214e0298df74 Mon Sep 17 00:00:00 2001 From: Christoph Gohlke Date: Sun, 21 Sep 2014 17:50:07 -0700 Subject: [PATCH] On Windows, do not execute convert.exe without specifying path Convert.exe is a system tool that converts file systems --- Tests/helper.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Tests/helper.py b/Tests/helper.py index 3d875983e..e510f307c 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -155,7 +155,7 @@ class PillowTestCase(unittest.TestCase): raise IOError() outfile = self.tempfile("temp.png") - if command_succeeds(['convert', f, outfile]): + if command_succeeds([IMCONVERT, f, outfile]): from PIL import Image return Image.open(outfile) raise IOError() @@ -251,6 +251,14 @@ def netpbm_available(): def imagemagick_available(): - return command_succeeds(['convert', '-version']) + return IMCONVERT and command_succeeds([IMCONVERT, '-version']) + + +if sys.platform == 'win32': + IMCONVERT = os.environ.get('MAGICK_HOME', '') + if IMCONVERT: + IMCONVERT = os.path.join(IMCONVERT, 'convert.exe') +else: + IMCONVERT = 'convert' # End of file