Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ec6330b

Browse filesBrowse files
committed
Merge remote-tracking branch 'origin/pr/5460' into HEAD
2 parents b32f9c1 + a30ec66 commit ec6330b
Copy full SHA for ec6330b

File tree

Expand file treeCollapse file tree

1 file changed

+24
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+24
-1
lines changed

‎lib/matplotlib/animation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+24-1Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from matplotlib.cbook import iterable, is_string_like
3939
from matplotlib.compat import subprocess
4040
from matplotlib import verbose
41-
from matplotlib import rcParams
41+
from matplotlib import rcParams, rcParamsDefault
4242

4343
# Process creation flag for subprocess to prevent it raising a terminal
4444
# window. See for example:
@@ -267,6 +267,8 @@ def isAvailable(cls):
267267
Check to see if a MovieWriter subclass is actually available by
268268
running the commandline tool.
269269
'''
270+
if not cls.bin_path():
271+
return False
270272
try:
271273
p = subprocess.Popen(cls.bin_path(),
272274
shell=False,
@@ -551,6 +553,27 @@ def delay(self):
551553
def output_args(self):
552554
return [self.outfile]
553555

556+
@classmethod
557+
def _init_from_registry(cls):
558+
if sys.platform != 'win32' or rcParams[cls.exec_key] != 'convert':
559+
return
560+
from matplotlib.externals.six.moves import winreg
561+
for flag in (0, winreg.KEY_WOW64_32KEY, winreg.KEY_WOW64_64KEY):
562+
try:
563+
hkey = winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE,
564+
'Software\\Imagemagick\\Current',
565+
0, winreg.KEY_QUERY_VALUE | flag)
566+
binpath = winreg.QueryValueEx(hkey, 'BinPath')[0]
567+
winreg.CloseKey(hkey)
568+
binpath += '\\convert.exe'
569+
break
570+
except Exception:
571+
binpath = ''
572+
rcParams[cls.exec_key] = rcParamsDefault[cls.exec_key] = binpath
573+
574+
575+
ImageMagickBase._init_from_registry()
576+
554577

555578
@writers.register('imagemagick')
556579
class ImageMagickWriter(MovieWriter, ImageMagickBase):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.