⬅︎ Back to What I hate about PIL and Image in Python
At least on my machine these two are not the same:In [14]: import PILIn [15]: PIL.__file__Out[15]: '/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/__init__.pyc'In [16]: import ImageIn [17]: Image.__file__Out[17]: '/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/Image.pyc'In [18]: dir(PIL)Out[18]: ['__builtins__', '__doc__', '__file__', '__name__', '__path__']In [19]: dir(Image)Out[19]: ['ADAPTIVE', 'AFFINE', 'ANTIALIAS', 'BICUBIC', 'BILINEAR', 'CONTAINER', 'CUBIC', 'DEBUG', 'EXTENSION', 'EXTENT', 'FLIP_LEFT_RIGHT', 'FLIP_TOP_BOTTOM', 'FLOYDSTEINBERG', 'ID', 'Image', 'ImageMode', 'ImagePalette', 'IntType', 'LINEAR', 'MESH', 'MIME', 'MODES', 'NEAREST', 'NONE', 'NORMAL', 'OPEN', 'ORDERED', 'PERSPECTIVE', 'QUAD', 'RASTERIZE', 'ROTATE_180', 'ROTATE_270', 'ROTATE_90', 'SAVE', 'SEQUENCE', 'StringType', 'TupleType', 'UnicodeStringType', 'VERSION', 'WEB', '_E', '_ENDIAN', '_ImageCrop', '_MAPMODES', '_MODEINFO', '_MODE_CONV', '__builtins__', '__doc__', '__file__', '__name__', '_conv_type_shape', '_getdecoder', '_getencoder', '_getscaleoffset', '_imaging_not_installed', '_initialized', '_showxv', '_wedge', 'blend', 'composite', 'core', 'eval', 'fromarray', 'frombuffer', 'fromstring', 'getmodebandnames', 'getmodebands', 'getmodebase', 'getmodetype', 'init', 'isDirectory', 'isImageType', 'isNumberType', 'isSequenceType', 'isStringType', 'isTupleType', 'merge', 'new', 'open', 'os', 'preinit', 'register_extension', 'register_mime', 'register_open', 'register_save', 'string', 'sys', 'warnings']
I believe this is the real problem:>>> from PIL import Image as A>>> import Image as B>>> B.__file__ == A.__file__True
Comment
At least on my machine these two are not the same:
In [14]: import PIL
In [15]: PIL.__file__
Out[15]: '/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/__init__.pyc'
In [16]: import Image
In [17]: Image.__file__
Out[17]: '/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/Image.pyc'
In [18]: dir(PIL)
Out[18]: ['__builtins__', '__doc__', '__file__', '__name__', '__path__']
In [19]: dir(Image)
Out[19]:
['ADAPTIVE',
'AFFINE',
'ANTIALIAS',
'BICUBIC',
'BILINEAR',
'CONTAINER',
'CUBIC',
'DEBUG',
'EXTENSION',
'EXTENT',
'FLIP_LEFT_RIGHT',
'FLIP_TOP_BOTTOM',
'FLOYDSTEINBERG',
'ID',
'Image',
'ImageMode',
'ImagePalette',
'IntType',
'LINEAR',
'MESH',
'MIME',
'MODES',
'NEAREST',
'NONE',
'NORMAL',
'OPEN',
'ORDERED',
'PERSPECTIVE',
'QUAD',
'RASTERIZE',
'ROTATE_180',
'ROTATE_270',
'ROTATE_90',
'SAVE',
'SEQUENCE',
'StringType',
'TupleType',
'UnicodeStringType',
'VERSION',
'WEB',
'_E',
'_ENDIAN',
'_ImageCrop',
'_MAPMODES',
'_MODEINFO',
'_MODE_CONV',
'__builtins__',
'__doc__',
'__file__',
'__name__',
'_conv_type_shape',
'_getdecoder',
'_getencoder',
'_getscaleoffset',
'_imaging_not_installed',
'_initialized',
'_showxv',
'_wedge',
'blend',
'composite',
'core',
'eval',
'fromarray',
'frombuffer',
'fromstring',
'getmodebandnames',
'getmodebands',
'getmodebase',
'getmodetype',
'init',
'isDirectory',
'isImageType',
'isNumberType',
'isSequenceType',
'isStringType',
'isTupleType',
'merge',
'new',
'open',
'os',
'preinit',
'register_extension',
'register_mime',
'register_open',
'register_save',
'string',
'sys',
'warnings']
Replies
I believe this is the real problem:
>>> from PIL import Image as A
>>> import Image as B
>>> B.__file__ == A.__file__
True