Closed Schweinepriester closed 5 years ago
Do you think you could provide the return code from convert --version
in PowerShell? Run this after convert --version
to get the exit code:
Write-Host "Code: $LASTEXITCODE"
Sure! :)
PS C:\Users\Kai> convert --version
Version: ImageMagick 7.0.2-1 Q16 x64 2016-06-23 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
PS C:\Users\Kai> Write-Host "Code: $LASTEXITCODE"
Code: 0
I ran into this while experimenting with ImageMagick on Windows recently. The problem is that Windows has a convert.exe
that shadows IM's convert.exe
program. There's more background in this thread: https://github.com/beetbox/beets/issues/670#issuecomment-225279659
And there's also a relevant SO answer: http://stackoverflow.com/questions/15016974/running-imagemagick-convert-console-application-from-python
Alas, the behavior from inside beets doesn't necessarily match the behavior when typing convert
in PowerShell. I wasn't able to find a way to make this work out of the box, so I think the only solution is to add a configuration option to beets to let you specify full paths to the IM tools. Unless anyone else has a better idea?
What I didnt get from reading the thread is: What has changed to break this? Since it seemed to work in the past (1.3.16, .17 probably too)?
Is there any chance it was failing silently before? In previous versions, we could be erroneously convinced that we had a working convert
and we'd just go ahead and try to use it -- which would fail every time.
There is a chance - how can we be sure? Place a large art file locally and force resizing using <1.3.18?
That seems logical -- but I'm reasonably confident that's what's going on. I can't see any other way around this aside from using a full, explicit path to the convert
executable.
@sampsyo: I don't know how I forgot about my replies in #670 😆. Using absolute paths does seem to be the best way 😕. I still don't understand why cmd.exe
prefers the built in convert.exe
(when using shell=True
) instead of the one provided by ImageMagick? Is it not %PATH%
for some reason?
:smiley: Good point! You were the one who originally pointed this out.
I think the deal is that using shell=False
, which we do for sanity reasons, doesn't use the Windows %PATH%
at all. I admittedly don't understand this very well, but I think this SO answer indicates that you only get executables in the current working directory and builtins: http://stackoverflow.com/a/5659249
On the other hand, while searching for details, I found this other SO answer that seems to indicate that the problem is just that %PATH%
doesn't get inherited by the invocation by default. Explicitly threading it through might work: http://stackoverflow.com/a/14679560
That report seems a little unreliable, but perhaps worth a try?
Fixed in #3236 by using the magick
executable when it's available. Presumably, Windows doesn't have a built-in, conflicting magick.exe
. :smiley:
ImageMagick/artresizer fails on windows?
Setup
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32
Turning off plugins made problem go away (yes/no):My configuration (output of
beet config
) is: