Change Image import to support Pillow#6
Conversation
PIL is no longer actively developed, but Pillow is an almost drop-in replacement. It requires only that the Image module be imported from the PIL namespace and not from the global one
|
I dig this 👍 But Pillow is not that extended. Should be changed to try Pillow and if it fails, use PIL. Also update error messages |
|
Spot on, gcq. Try pillow, fall back to PIL, if both fail, raise the ImportError. |
|
I have 64 bit Python installed and I couldn't find a PIL for 64 bits. When I tried with the 32 bit one, it crashed, but only after getting imported with So there is no need for a fallback, because Python automatically uses the one that is installed. I think the only reason why this change is necessary is because PIL is doing some import magic, setting itself up in the global namespace (which is not a good practice), while Pillow uses only the PIL namespace. |
|
Oh i understand now, i thought that PIL installed the Image module along the PIL module, but turns out it doesn't. If thats correct, the only thing remaining to change is the error message, to something along the lines of: |
PIL is no longer actively developed, but Pillow is an almost drop-in replacement. It requires only that the Image module be imported from the PIL namespace and not from the global one