-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Do not run Windows' file system convert tool #5460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
It would seem better to me to put this in the Imagemagick-specific classes rather than |
@dopplershift I don't feel strongly about this but I guess that in principle another movie writer could have a tool called convert? I was thinking about adding support for graphicsmagick which is a fork of imagemagick (what is it with movie tools and forks?). In that case the command line argument has changed to |
The path to ImageMagick's convert tool could be read from the Windows Registry if the full path is not already specified in rcParams. The multiple inheritance does not make this easy. The simplest I could come up with is to update rcParams and rcParamsDefault in animation.py. Is that an option? class ImageMagickBase(object):
exec_key = 'animation.convert_path'
args_key = 'animation.convert_args'
@property
def delay(self):
return 100. / self.fps
@property
def output_args(self):
return [self.outfile]
@classmethod
def _init_from_registry(cls):
if sys.platform != 'win32' or rcParams[cls.exec_key] != 'convert':
return
from matplotlib.externals.six.moves import winreg
try:
hkey = winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE,
'Software\\Imagemagick\\Current',
0, winreg.KEY_QUERY_VALUE)
binpath = winreg.QueryValueEx(hkey, 'BinPath')[0]
winreg.CloseKey(hkey)
binpath += '\\convert.exe'
except Exception:
binpath = ''
rcParams[cls.exec_key] = rcParamsDefault[cls.exec_key] = binpath
ImageMagickBase._init_from_registry() The isAvailable function could then check that rcParams[cls.exec_key] is not empty. |
@cgohlke 👍 I see no problem with that solution. I assume it works on the subset of windows versions you think need to be supported? |
I still have to check/implement that the 64-bit version of matplotlib can detect a 32-bit installation of ImageMagick and the 32-bit version of matplotlib can detect a 64-bit installation of ImageMagick. I guess the current code does not. |
Is that really necessary? It's just communicating over a pipe, isn't it? |
I was referring to the code detecting the ImageMagick location via registry settings. It needs revision for handling 32 and 64 bit combinations of Python and ImageMagick because of the way Windows stores 32-bit and 64-bit Application Data in the Registry |
Ah, I see. ImageMagick's page on the registry keys doesn't yet mention that little hiccup. |
I'm not sure whether this PR was totally finished, but it got pulled in via #5604. It will need a backport if this milestone is still correct. |
hmm, this will be a fun one to backport. It got auto-closed because these commits went in as part of #5604 @cgohlke the code in the patch is slightly different than what you posted in the comments. It looks like it copes with the 32 vs 64 registry issues, but I do not know enough about windows to be sure (on the other hand, it seems to be working on appveyor so that is a good sign right?) |
Yes, this PR is totally finished. Appveyor only tests without ImageMagick. |
This commit squashes 87c968b a30ec66 and cherry-picks them to the v1.5.x branch. These commits were merged to master as part of #5604 which was not backported en-mass. Original commit messages: Do not run Windows' file system convert tool On Windows, initialize the animation.convert_path setting from the Registry
This was backported to 1.5.x as 2e9ff44 |
See also #5446.
This should fix two test errors on Windows when ImageMagick is not set up correctly: