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

Skip to content

Commit a117e19

Browse files
committed
texmanager: Ignore dvipng if it cannot be found, instead of raising OSError.
1 parent b29c93c commit a117e19

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/matplotlib/texmanager.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@
6363

6464

6565
def dvipng_hack_alpha():
66-
p = Popen('dvipng -version', shell=True, stdin=PIPE, stdout=PIPE,
67-
stderr=STDOUT, close_fds=(sys.platform != 'win32'))
66+
try:
67+
p = Popen('dvipng -version', stdin=PIPE, stdout=PIPE, stderr=STDOUT,
68+
close_fds=(sys.platform != 'win32'))
69+
except OSError:
70+
mpl.verbose.report('No dvipng was found', 'helpful')
71+
return False
6872
stdin, stdout = p.stdin, p.stdout
6973
for line in stdout:
7074
if line.startswith(b'dvipng '):
@@ -74,7 +78,7 @@ def dvipng_hack_alpha():
7478
version = version.decode('ascii')
7579
version = distutils.version.LooseVersion(version)
7680
return version < distutils.version.LooseVersion('1.6')
77-
mpl.verbose.report('No dvipng was found', 'helpful')
81+
mpl.verbose.report('Unexpected response from dvipng -version', 'helpful')
7882
return False
7983

8084

0 commit comments

Comments
 (0)