[Zope] PIL/Zope Problem
Marcello Lupo
lupo@atisworld.com
Fri, 27 Oct 2000 14:38:31 +0200
Hi to all,
i read all the documentation and made all things to let interact PIL and
Zope and i cannot find the way to make it work.
If i try to import PIL from pyton interpreter it works perfectly with:
*******************************
Python 1.5.2 (#1, Jul 17 1999, 22:10:16) [GCC egcs-2.91.66
19990314/Linux (egcs- on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import PIL
>>> data=PIL.Image.open("/home/httpd/listanozze/docs/images/prove/ccc.jpg","r")
>>> print data.format
JPEG
>>> print data.info
{'adobe_transform': 1, 'progression': 1, 'adobe': 100, 'jfif': 258}
>>> print data.size
(450, 309)
>>>
******************************
as you can see it works.
But when i try to access PIL.Image.open from an external method in Zope
i get:
*******************************
Error Type: AttributeError
Error Value: Image
Troubleshooting Suggestions
The URL may be incorrect.
The parameters passed to this resource may be
incorrect.
A resource that this resource relies on may be
encountering an error.
For more detailed information about the error, please refer
to the HTML source for this page.
If the error persists please contact the site maintainer.
Thank you for your patience.
Traceback (innermost last):
File /home/httpd/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line
214, in publish_module
File /home/httpd/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line
179, in publish
File /home/httpd/Zope-2.1.6-src/lib/python/Zope/__init__.py, line 202,
in zpublisher_exception_hook
(Object: ElementWithAttributes)
File /home/httpd/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line
165, in publish
File /home/httpd/Zope-2.1.6-src/lib/python/ZPublisher/mapply.py, line
160, in mapply
(Object: pippo)
File /home/httpd/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line
102, in call_object
(Object: pippo)
File /home/httpd/Zope-2.1.6-src/lib/python/OFS/DTMLMethod.py, line
150, in __call__
(Object: pippo)
File
/home/httpd/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
(Object: pippo)
File
/home/httpd/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_Util.py, line
335, in eval
(Object: resize_image(foto))
(Info: foto)
File <string>, line 0, in ?
File
/home/httpd/Zope-2.1.6-src/lib/python/Products/ExternalMethod/ExternalMethod.py,
line 255, in __call__
(Object: resize_image)
(Info: ((<ZPublisher.HTTPRequest.FileUpload instance at 8565c90>,),
{}, None))
File /home/httpd/Zope-2.1.6-src/Extensions/image_op.py, line 7, in
resize_image
(Object: ElementWithAttributes)
AttributeError: (see above)
*********************************
My external Method say:
****************************
import PIL
def resize_image(self, foto):
if foto:
data=PIL.Image.open(foto)
data=data.resize((128, 128))
return data.size
else:
return "Nothing"
***************************************
Can anyone help me??
Thanks
Bye,
MArcello