Skip to content

Commit

Permalink
MNT : better error handling on determining gs version
Browse files Browse the repository at this point in the history
If we fail to parse the version string return (0, 0) to let
the code for dealing with out-of-date versions of gs handle
the case of not installed.
  • Loading branch information
tacaswell committed Jul 24, 2014
1 parent 010a485 commit ae62a35
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/matplotlib/backends/backend_ps.py
Expand Up @@ -56,6 +56,7 @@ def _fn_name(): return sys._getframe(1).f_code.co_name

debugPS = 0


class PsBackendHelper(object):

def __init__(self):
Expand All @@ -78,7 +79,6 @@ def gs_exe(self):
self._cached["gs_exe"] = gs_exe
return gs_exe


@property
def gs_version(self):
"""
Expand All @@ -97,8 +97,11 @@ def gs_version(self):
ver = pipe.decode('ascii')
else:
ver = pipe
gs_version = tuple(map(int, ver.strip().split(".")))

try:
gs_version = tuple(map(int, ver.strip().split(".")))
except ValueError:
# if something went wrong parsing return null version number
gs_version = (0, 0)
self._cached["gs_version"] = gs_version
return gs_version

Expand Down

0 comments on commit ae62a35

Please sign in to comment.