On Windows, do not execute convert.exe without specifying path

Convert.exe is a system tool that converts file systems
This commit is contained in:
Christoph Gohlke 2014-09-21 17:50:07 -07:00
parent 91588383e7
commit 09ba5560d8

View File

@ -155,7 +155,7 @@ class PillowTestCase(unittest.TestCase):
raise IOError() raise IOError()
outfile = self.tempfile("temp.png") outfile = self.tempfile("temp.png")
if command_succeeds(['convert', f, outfile]): if command_succeeds([IMCONVERT, f, outfile]):
from PIL import Image from PIL import Image
return Image.open(outfile) return Image.open(outfile)
raise IOError() raise IOError()
@ -251,6 +251,14 @@ def netpbm_available():
def imagemagick_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 # End of file