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

Skip to content

Commit cd3b775

Browse files
committed
Correct stdout in dvipng_hack
1 parent dfcbe97 commit cd3b775

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/texmanager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ def dvipng_hack_alpha():
7070
try:
7171
p = Popen(['dvipng', '-version'], stdin=PIPE, stdout=PIPE,
7272
stderr=STDOUT, close_fds=(sys.platform != 'win32'))
73-
stdin, stderr = p.communicate()
73+
stdout, stderr = p.communicate()
7474
except OSError:
7575
mpl.verbose.report('No dvipng was found', 'helpful')
7676
return False
77-
for line in stdout:
78-
if line.startswith(b'dvipng '):
77+
lines = stdout.decode('ascii').split('\n')
78+
for line in lines:
79+
if line.startswith('dvipng '):
7980
version = line.split()[-1]
8081
mpl.verbose.report('Found dvipng version %s' % version,
8182
'helpful')
82-
version = version.decode('ascii')
8383
version = distutils.version.LooseVersion(version)
8484
return version < distutils.version.LooseVersion('1.6')
8585
mpl.verbose.report('Unexpected response from dvipng -version', 'helpful')

0 commit comments

Comments
 (0)