[Zope] problem with PIL .save

Francisco Silva Domingues domingues@came.sbg.ac.at
Thu, 17 May 2001 15:12:36 +0200


Hi,

We have Zope 2.3.1 installed, running with Python 1.5.2, and 
python image library 1.1.1, on a PC with SUSE Linux  7.1.

When we run the following code from python we have no prob,
we get the rectangle image file img.png, and we also see it
in xv according to the im.show()

    import Image, ImageDraw
    im = Image.new("RGB",(200,200))
    draw = ImageDraw.Draw(im)
    draw.rectangle((10,10,100,150), fill=(255,255,255))
    del draw
    im.show()
    im.save("/usr/tmp/img.png","PNG")

Now the problem is when we use the same code in a python external
method called from zope. we get the following error:


Error Type: AttributeError
Error Value: _save

...
/db1/Zope-2.3.1-linux2-x86/Extensions/feature_view.py, line 114, in 
draw_segment
  File /usr/local/lib/python1.5/site-packages/PIL/Image.py, line 674, in save
  File /usr/local/lib/python1.5/site-packages/PIL/PngImagePlugin.py, line 
410, in _save
AttributeError: (see above)

feature_view.py, line 114 corresponds to the im.save line

The funny thing is that a img.png file is saved to disk, but is corrupted, 
but we still  can see the correct image from xv, according to the  im.show() 
call.

Any idea on what the prob might be??

Thanks
Francisco
Andreas