Skip to content

Commit 6c6cf91

Browse files
committed
Fix: rerun check for imagemagick in isAvailable
On windows the check ensures that the imagemagick path for 'convert' was set to '' if it was just 'convert' to prevent clashes with the windows built-in command 'convert' (doing filesystem conversion). Unfortunately, the command only set this values in the current rcParams and rcParamsDefault, but a use of `matplotlib.style.use("classic")` after importing mpl.animation would again overwrite it with `convert`. In this case, the image comparison decorator sets the style to classic and appveyor went BOOM...
1 parent 6a01829 commit 6c6cf91

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

lib/matplotlib/animation.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,11 @@ def isAvailable(cls):
338338
Check to see if a MovieWriter subclass is actually available by
339339
running the commandline tool.
340340
'''
341-
if not cls.bin_path():
341+
bin_path = cls.bin_path()
342+
if not bin_path:
342343
return False
343344
try:
344-
p = subprocess.Popen(cls.bin_path(),
345+
p = subprocess.Popen(bin_path,
345346
shell=False,
346347
stdout=subprocess.PIPE,
347348
stderr=subprocess.PIPE,
@@ -642,12 +643,22 @@ def _init_from_registry(cls):
642643
binpath = ''
643644
rcParams[cls.exec_key] = rcParamsDefault[cls.exec_key] = binpath
644645

646+
@classmethod
647+
def isAvailable(cls):
648+
'''
649+
Check to see if a MovieWriter subclass is actually available by
650+
running the commandline tool.
651+
'''
652+
bin_path = cls.bin_path()
653+
if bin_path == "convert":
654+
cls._init_from_registry()
655+
return super(ImageMagickBase, cls).isAvailable()
645656

646657
ImageMagickBase._init_from_registry()
647658

648659

649660
@writers.register('imagemagick')
650-
class ImageMagickWriter(MovieWriter, ImageMagickBase):
661+
class ImageMagickWriter(ImageMagickBase, MovieWriter, ):
651662
def _args(self):
652663
return ([self.bin_path(),
653664
'-size', '%ix%i' % self.frame_size, '-depth', '8',
@@ -657,7 +668,7 @@ def _args(self):
657668

658669

659670
@writers.register('imagemagick_file')
660-
class ImageMagickFileWriter(FileMovieWriter, ImageMagickBase):
671+
class ImageMagickFileWriter(ImageMagickBase, FileMovieWriter):
661672
supported_formats = ['png', 'jpeg', 'ppm', 'tiff', 'sgi', 'bmp',
662673
'pbm', 'raw', 'rgba']
663674

0 commit comments

Comments
 (0)