[Zope] External Methods ->syntax + file access = how ?
Phil Harris
phil@wigwamweb.net
Fri, 29 Oct 1999 12:31:13 +0100
Jason,
Have you made PIL into a package?
PIL and Zope both have objects called Image/ImageFile so when you import
Image for instance, do you really know which one is being imported.
There was some discussion a while back about this.
There is a PIL friendly poll product at the old zope site
(http://www.zope.org:8080/Download/Contrib/poll.tgz) that explains what you
have to do to get them both working together.
HTH
Phil
phil@WigWamWeb.net
-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Jason
Cunliffe
Sent: Friday, October 29, 1999 11:58 AM
To: zope@zope.org
Subject: [Zope] External Methods ->syntax + file access = how ?
Trying to get PIL [Python Imaging Library.
http://www.pythonware.com/products/pil/ ] and other modules to work via
Zope External Methods. But so far getting hung up on some simple
understanding about Python and Zope. Searched archives, but I could find
the answer.
When testing outside of Zope, from python shell such as Idle, everything
works OK. But inside Zope I keep getting file, URL, or resources not found
- error messages, whenever I try to open an image into my python code.
Seems like it's either blocked by security checks and/or I am making newbie
path mistakes.
I've tried a lot of variations with setting paths, experimenting with
os.chdir(), and checking the files visible to my code using
os.listdir(os.getcwd()). I can import the PIL modules and see the files I
want to open in the 'Extensions' folder, but can't open them.
At present, all the PIL files are in the 'Extensions' folder, but I
understand from the ZCMG that I could also put them in 'Shared'. The ZCMG
says that I can create a folder in 'Shared' with company or personal name
and then this will be automatically referenced by zope. What is not clear
to me what name, why and what do I ave to do to tell zope about the folder
name I have created there.?
Most of PIL is just python and suffices to parse the image headers, but for
image processing, PIL uses a platform-specific library (ie: _imaging.dll on
Win32). Where should this go on a ZopeSite? And what is my path needs to
import PIL.
minimal external method for testing :
#pil_test.py
import os, sys
import Image
def pil_test(self):
infile = 'animage.jpg'
im = Image.open(infile)
return im.size, im.format, im.mode
won't work: errors as above.
..So I tried opening a simple text text file in 'Extensions' and that
failed.
Is this illegal??
How do I use python external method to 'open' any file.? Do I have to
import htmllib or somesuch and use that to point at my ZopeSite or
elsewhere? I've already tested this with loading and displaying local and
remote HMTL pages in open. fun,very cool.
What syntax will directly load Zope 'Image' objects into Python external
methods.
The zope error messages reference line 110 of Image.py and line 716 of
ImageFile.py
So far I 've come up with 4 possibles:
1. The namespace of Zope 'Image' is getting confused by imported PIL 'Image'
2. What I am doing is illegal
3. I am in wrong path
4. Dumb newbie typos
I am very keen to get this working, so that we can get on with creating a
set of nice Zope image processing methods. These can allow much friendlier
end-user uploading of images with automatic linked indexes, thumbnailing,
sending e-mail to user groups of images, image compositing etc.
Thanks in advance for any tips
- Jason Cunliffe
-------------------------------------------------
Jason Cunliffe <jasonic@nomadicsltd.com>
NOMADICS.STUDIO(Design Director)
Geo-Digital Arts and Technology
Le Vieux Moulin, Route de Mons
83440 SEILLANS, FRANCE
Tel: +33 (0)4 94.76.98.72
Fax: +33 (0)4 94.76.97.77
_______________________________________________
Zope maillist - Zope@zope.org
http://www.zope.org/mailman/listinfo/zope
(Related lists - please, no cross posts or HTML encoding!
To receive general Zope announcements, see:
http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org -
http://www.zope.org/mailman/listinfo/zope-dev )