[Zope] PIL: can't call same method twice
David Hassalevris
bluepaul at earthlink.net
Sat Mar 5 12:14:02 EST 2005
Chris wrote:
> Hi David,
>
> this is not the problem (tried it before).
>
> The code
> foo = container.resize(context.REQUEST.image, size=size) # works nicely
> foo = container.resize(context.REQUEST.image, size=size) # 2nd time
> ->error
> does what you suggest. But it raises the same error.
>
> I looked at the request to see whether image is altered during the
> resize (but why should it be altert at all?): before and after resize
> the request has
> image <ZPublisher.HTTPRequest.FileUpload instance at 0x9668e2c>
> as expected.
>
> It lookt more like a bug (?!?) in the PIL-code. So I looked into the
> open method of PIL.Image.py (PIL 1.1.4) to no avail. With my limited
> knowedge I could not see anything obvious. The open() method opens the
> file "read-only" and tryes to identify the file by reading some header
> information of the file instance. This is failing however. I guess the
> prefix is not identified correctly. To do this, open() reads the first
> 16 characters ot the file. Since I don't know much about the header
> informations of images (tryed jpg and gif) I can not tell whether they
> are correct.
>
> So I still have no clue :-(
>
> Regards Chris
>
Chris,
Yes! My suggestion would have made sense if image was passed by ref.
But then this *is* python. If you can post ready-to-go code that
reproduces this I'd be curious to take a look if for no other reason
than I've been meaning to do to PIL stuff myself (i want to convert some
chess parser code into python and display diagrams). Plus, there are
others who may enjoy taking a crack at it just for the heck of it.
David
More information about the Zope
mailing list