mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
Better docs explaining import _imaging failure [ci skip]
This commit is contained in:
parent
482f658704
commit
b13a90441f
10
PIL/Image.py
10
PIL/Image.py
|
@ -55,10 +55,11 @@ except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# If the _imaging C module is not present, you can still use
|
# If the _imaging C module is not present, Pillow will not load.
|
||||||
# the "open" function to identify files, but you cannot load
|
# Note that other modules should not refer to _imaging directly;
|
||||||
# them. Note that other modules should not refer to _imaging
|
# import Image and use the Image.core variable instead.
|
||||||
# directly; import Image and use the Image.core variable instead.
|
# Also note that Image.core is not a publicly documented interface,
|
||||||
|
# and should be considered private and subject to change.
|
||||||
from PIL import _imaging as core
|
from PIL import _imaging as core
|
||||||
if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
|
if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
|
||||||
raise ImportError("The _imaging extension was built for another "
|
raise ImportError("The _imaging extension was built for another "
|
||||||
|
@ -91,6 +92,7 @@ except ImportError as v:
|
||||||
RuntimeWarning
|
RuntimeWarning
|
||||||
)
|
)
|
||||||
# Fail here anyway. Don't let people run with a mostly broken Pillow.
|
# Fail here anyway. Don't let people run with a mostly broken Pillow.
|
||||||
|
# see docs/porting-pil-to-pillow.rst
|
||||||
raise
|
raise
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -21,3 +21,7 @@ automatically imports any file in the Python path with a name ending
|
||||||
in :file:`ImagePlugin.py`. You will need to import your image plugin
|
in :file:`ImagePlugin.py`. You will need to import your image plugin
|
||||||
manually.
|
manually.
|
||||||
|
|
||||||
|
Pillow will raise an exception if the core extension can't be loaded
|
||||||
|
for any reason, including a version mismatch between the Python and
|
||||||
|
extension code. Previously PIL allowed Python only code to run if the
|
||||||
|
core extension was not available.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user