mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 02:36:17 +03:00
Delayed import error for doc use
This commit is contained in:
parent
b6955fcf15
commit
90bbd9ff3e
|
@ -84,7 +84,13 @@ VERSION = "1.0.0 pil"
|
||||||
# --------------------------------------------------------------------.
|
# --------------------------------------------------------------------.
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
try:
|
||||||
from PIL import _imagingcms
|
from PIL import _imagingcms
|
||||||
|
except ImportError:
|
||||||
|
# Allow error import for doc purposes, but error out when accessing
|
||||||
|
# anything in core.
|
||||||
|
from _util import import_err
|
||||||
|
_imagingcms = import_err('ImagingCMS')
|
||||||
from PIL._util import isStringType
|
from PIL._util import isStringType
|
||||||
|
|
||||||
core = _imagingcms
|
core = _imagingcms
|
||||||
|
|
|
@ -14,3 +14,9 @@ else:
|
||||||
# Checks if an object is a string, and that it points to a directory.
|
# Checks if an object is a string, and that it points to a directory.
|
||||||
def isDirectory(f):
|
def isDirectory(f):
|
||||||
return isPath(f) and os.path.isdir(f)
|
return isPath(f) and os.path.isdir(f)
|
||||||
|
|
||||||
|
class import_err(object):
|
||||||
|
def __init__(self, name=''):
|
||||||
|
self.name = name
|
||||||
|
def __getattr__(self, elt):
|
||||||
|
raise Exception("Import Error, %s not available" % self.name)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user