[Zope] System Error from Zope Book Example
Dieter Maurer
dieter@handshake.de
Wed, 20 Feb 2002 00:14:54 +0100
Chris Withers writes:
> Dan Shafer wrote:
> >
> > def makeThumbnail(self, original_id, size=128)
> >
> > from PIL import Image
> > from cStringIO import StringIO
> > import os.path
> >
> > # create a thumbnail image file
> > original_image=getattr(self, original_id)
> > original_file=StringIO(original_image.data)
>
> So, this is the line with the bug.
This almost surely is the large image bug already discussed
and solved in the mailing list!
When image is sufficiently large, "image.data" is no longer a string
but a complex object.
Fix: use "str(original_image.data)" rather than "original_image.data)".
If you can, fix the buggy example, too.
Dieter