replace deprecation

This commit is contained in:
Mario Voigt 2021-12-25 20:35:45 +01:00
parent 789a04e078
commit 980772f41c
1 changed files with 3 additions and 3 deletions

View File

@ -4,11 +4,11 @@ import sys
import os import os
import argparse import argparse
import inkex import inkex
import shutil
from inkex import Rectangle from inkex import Rectangle
from PIL import Image from PIL import Image
import base64 import base64
from io import BytesIO, StringIO from io import BytesIO, StringIO
from distutils.spawn import find_executable
import subprocess import subprocess
from lxml import etree from lxml import etree
@ -23,9 +23,9 @@ class WebpImport(inkex.InputExtension):
else: else:
tmp = '/tmp/' tmp = '/tmp/'
convertfile = os.path.join(tmp, "webp.png") convertfile = os.path.join(tmp, "webp.png")
if find_executable('magick'): if shutil.which('magick'):
command = "magick \"%s\" \"%s\" " % (self.options.inputfile, convertfile) command = "magick \"%s\" \"%s\" " % (self.options.inputfile, convertfile)
elif find_executable('convert'): elif shutil.which('convert'):
command = "convert \"%s\" \"%s\" " % (self.options.inputfile, convertfile) command = "convert \"%s\" \"%s\" " % (self.options.inputfile, convertfile)
else: else:
inkex.errormsg('ImageMagick does not appear to be installed.') inkex.errormsg('ImageMagick does not appear to be installed.')