I find this code in Django:
# Try to import PIL in either of the two ways it can end up installed.
try:
from PIL import ImageFile as PILImageFile
except ImportError:
import ImageFile as PILImageFile
and up until recently, I just blew it off as unimportant. However I built PIL under my virtualenv in windows and all of a sudden
from PIL import Image
doesn't work anymore, I have to use
import Image
So, now I want to understand why and what is going on.
Initially I was using PIL installed with the windows installer. But I needed read support for Group4 Faxes so I did the mods and then got PIL to build and install under virtualenv on windows (something that is trivial on linux and a PITA on windows). But, now I have to use the second form of import, even though pip freeze
shows that PIL==1.1.7
in installed.
How is it that first import form doesn't work even though PIL appears to be installed, and the second form works (and the PIL code is functioning), indicating it is installed, but doesn't show up under PIL.