Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0fc4ad6

Browse files
author
Joshua Taillon
committed
Change _get_executable_info() to catch ExecutableNotFoundError
1 parent 3b65d42 commit 0fc4ad6

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/matplotlib/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,12 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
331331
raise ExecutableNotFoundError(message)
332332
elif name == "inkscape":
333333
try:
334-
# use "without-gui" option (only works with inkscape version < 1.0):
335-
info = impl(["inkscape", "--without-gui", "-V"], "Inkscape ([^ ]*)")
336-
except subprocess.CalledProcessError as _cpe:
337-
# for inkscape v > 1.0, --without-gui is not needed:
334+
# use headless option first (works with inkscape version < 1.0):
335+
info = impl(["inkscape", "--without-gui", "-V"],
336+
"Inkscape ([^ ]*)")
337+
except ExecutableNotFoundError as _e:
338+
# if --without-gui is not accepted, we're using Inkscape v > 1.0
339+
# so try without the headless option:
338340
info = impl(["inkscape", "-V"], "Inkscape ([^ ]*)")
339341
if info and info.version >= "1.0":
340342
raise ExecutableNotFoundError(

0 commit comments

Comments
 (0)