diff --git a/PIL/ImageCms.py b/PIL/ImageCms.py index ec891d0e5..c875712c1 100644 --- a/PIL/ImageCms.py +++ b/PIL/ImageCms.py @@ -86,11 +86,11 @@ VERSION = "1.0.0 pil" from PIL import Image try: from PIL import _imagingcms -except ImportError: +except ImportError as ex: # Allow error import for doc purposes, but error out when accessing # anything in core. from _util import import_err - _imagingcms = import_err('ImagingCMS') + _imagingcms = import_err(ex) from PIL._util import isStringType core = _imagingcms diff --git a/PIL/_util.py b/PIL/_util.py index e1ede1217..761c258f1 100644 --- a/PIL/_util.py +++ b/PIL/_util.py @@ -16,7 +16,7 @@ def isDirectory(f): return isPath(f) and os.path.isdir(f) class import_err(object): - def __init__(self, name=''): - self.name = name + def __init__(self, ex): + self.ex = ex def __getattr__(self, elt): - raise Exception("Import Error, %s not available" % self.name) + raise self.ex