Re: [Zope] Zope/PIL collision - what to do?
try something like.... import PIL image = PIL.Image.open('foo.png') that way you do not have two names "Image" colliding in the names Zope sees jens ---- Jens Vagelpohl jens@digicool.com Software Engineer www.digicool.com Digital Creations (888) 344-4332 Got Zope? ---- on 10/26/00 18:44, Anselm Lingnau at lingnau@tm.informatik.uni-frankfurt.de wrote:
I'm trying to use the Python Imaging Library in an external Python method to modify some images dynamically. However, when I try to load an image:
import Image # from PIL - refers to PIL ImageFile module image = Image.open("foo.png")
the method crashes because the Image module sees the Zope »ImageFile« module instead of the one from PIL. The Zope module, of course, does something completely different from the other one. This is on Debian GNU/Linux 2.2 with Zope 2.2.2 (taken from the »unstable« distribution and re-built -- the Zope in Debian 2.2 is older) and the PIL 1.0.1 from the distribution.
How do I get around this?
Anselm
In article <B61E79BE.185F%jens@digicool.com>, Jens Vagelpohl <jens@digicool.com> wrote:
import PIL
image = PIL.Image.open('foo.png')
that way you do not have two names "Image" colliding in the names Zope sees
Thanks to everybody who responded. I tried doing this after a number of other attempts but it claimed not to be able to find a module called »PIL« -- then I restarted Zope and it worked. Anselm -- Anselm Lingnau ......................... lingnau@tm.informatik.uni-frankfurt.de You could shoot Microsoft Office off the planet and this country would run better. You would see everyone standing around saying, `I've got so much time now.' -- Scott McNealy
A simple question that's been bugging me: Regarding a "FooDocument/BarMethod": How do I reference the content of FooDocument inside BarMethod? At the moment, I'm using <dtml-var "this()"> which seems to call the __str__ method of FooDocument; or <dtml-var "_.getitem(_['id'],1)" where I want to render dtml too. My questions are: 1) is 'this()' intended to be used like this? 2) is there a nicer way of doing the getitem() shenanigans? It seems like a common enough task to warrant a shortcut. I feel I may be being extra dumb here. That's just me thinking aloud. My actual problem, however, is that although content_a/view_1 returns a view of content_a, I'd like to apply in turn a new view to the result, e.g. content_a/view_1/tableise The concept being that content (content_a, content_b) can be rendered in different ways (view_1, view_2) but is always displayed inside a table (tableise). If I do a <dtml-var "_.getitem(_['id'],1)"> in both view_1 and tableise, I get infinite recursion, of course. But I can't think of how else I might do it. Putting <dtml-var "this()"> in tableise makes all the HTML in view_1 render html-safe (< > etc). I was tableise to display view_1's HTML but not render its DTML. Any idea, anyone? Thanks, seb
participants (3)
-
Anselm Lingnau -
Jens Vagelpohl -
Seb Bacon