[Image-SIG] can't open an image in ASP application

Herb Verbesey HVerbesey at carolina.rr.com
Wed Aug 12 02:13:05 CEST 2009


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

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090811/0bdbc8dc/attachment-0001.htm>


More information about the Image-SIG mailing list