[Zope] PIL: can't call same method twice

Dieter Maurer dieter at handshake.de
Sat Mar 5 13:49:24 EST 2005


Chris wrote at 2005-3-5 00:09 +0100:
> ...
>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.

That's an easy one:

  "FileUpload" is a file like object.
  A file has a file pointer associated.
  When it is read, the file pointer is advanced -- reading thus
  has a side effect.

  Almost surely, your first call moved the file pointer to
  the end and the second one does not find content.

  You can use the "seek" method to reposition the file pointer.

-- 
Dieter


More information about the Zope mailing list