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

Skip to content

Commit dec272c

Browse files
authored
Merge pull request #17355 from jat255/fix_inkscape_detection
Change subprocess for inkscape version detection
2 parents 8f3f689 + 5962f1a commit dec272c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/matplotlib/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,14 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
330330
message = "Failed to find a Ghostscript installation"
331331
raise ExecutableNotFoundError(message)
332332
elif name == "inkscape":
333-
info = impl(["inkscape", "-V"], "^Inkscape ([^ ]*)")
333+
try:
334+
# use headless option first (works with inkscape version < 1.0):
335+
info = impl(["inkscape", "--without-gui", "-V"],
336+
"Inkscape ([^ ]*)")
337+
except ExecutableNotFoundError:
338+
# if --without-gui is not accepted, we're using Inkscape v > 1.0
339+
# so try without the headless option:
340+
info = impl(["inkscape", "-V"], "Inkscape ([^ ]*)")
334341
if info and info.version >= "1.0":
335342
raise ExecutableNotFoundError(
336343
f"You have Inkscape version {info.version} but Matplotlib "

0 commit comments

Comments
 (0)