Might be that Python's picking up some other module named "Image". Make sure that Image.__file__ (the location of the source for the image) is what you expect it to be in your different environments.
</F> On Wed, Aug 12, 2009 at 2:13 AM, Herb Verbesey <hverbe...@carolina.rr.com> wrote: > The following codes works fine when run directly in python: > > > > import Image > > if __name__ == '__main__': > > im = Image.open("e:\\wwwroot\\class59.jpg") > > print im.format, im.size, im.mode > > > > However, when I try inserting the following code in an ASP page I get an > error that says, “im=Image.open("e:\\wwwroot\\class59.jpg") AttributeError: > 'module' object has no attribute 'open'” > > > > <script LANGUAGE=Python RUNAT=SERVER> > > import Image > > im=Image.open("e:\\wwwroot\\cbreunion09\\class59.jpg") > > Response.write(im.size) > > </script> > > > > When I do dir(Image) from the console I get > > ['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'] > > > > But when I put Response.write(str(dir(Image))) inside my server script I > get: > > ['Image', '__builtins__', '__doc__', '__file__', '__name__'] in reply > > Any clue as to what I need to do to open the image in my server script? > > Herb Verbesey > > > > > > _______________________________________________ > Image-SIG maillist - image-...@python.org > http://mail.python.org/mailman/listinfo/image-sig > > _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig