[Zope] PIL: can't call same method twice
David Hassalevris
bluepaul at earthlink.net
Fri Mar 4 19:07:19 EST 2005
Chris wrote:
> Hi,
>
> I encounter a problem, that I can not explain at all:
>
> I have an external method to resize an image (see below). I can call
> the method without a problem from a script within Zope and it does
> it's job.
> Hovever, if I call it twice within the same script, I get the error
> "can not identify image" although the same FileUpload instance is passed.
>
> My (dummy-)script looks something like this:
> # call the ext. method 'resize' one or more times
> x=1 # does not work for x >1
> image=context.REQUEST.image # passed from a html-form
> for i in range(0,x):
> foo = context.resize(image, size=size)
>
> the external method 'resize' looks like this:
> def resize(self, image, size=200, resample='ANTIALIAS'):
> from PIL import Image
> image=Image.open(image)
> [...]
>
> I have no idea what the problem could be or where to look.
>
> Any advice would be a greate help.
> Regards Chris
Maybe move this line
image=context.REQUEST.image # passed from a html-form
inside your for loop. Maybe image is being changed iteratively.
eg,
for i in range(0,x):
image=context.REQUEST.image # passed from a html-form
foo = context.resize(image, size=size)
Just a guess,
David
More information about the Zope
mailing list