[Zope] Changing External Python Methods

Andreas Tille tillea@rki.de
Mon, 9 Sep 2002 14:54:53 +0200 (CEST)


Hello,

I'm fiddling arround with some External Python Methods and I have to admit
that it is a real pain to debug those Methods - at least I did not found a
reasonable way.  It makes me really crazy ist the fact that it seems that
Zope just caches the first version of the file which I putted into the
Extensions directory and later changes are simply ignored.

For instance I just try to do some processing onto an image named
bland.gif which is in the same folder of ZMI as the External Method.
I've got a.

   Error Type: IOError
   Error Value: [Errno 2] No such file or directory: 'bland.gif'

Well, besides the fact that I would like to know how to reference those
files I really want to know why the following code stolen from
http://www.zopelabs.com/cookbook/1010702887 works

    def MakeThumbHi2(self, image="test"):

	    oriImage = self.restrictedTraverse(image)
	    oriFile = cStringIO.StringIO(oriImage.data)

	    image = PIL.Image.open(oriFile)
	    image.thumbnail(100, 100)
	    image_type = image.format

	    thumbnailImage = cStringIO.StringIO()
	    image.save(thumbnailImage, image_type)
	    thumbnailImage.seek(0)

	    return thumbnailImage.getvalue()

and if I just replace my very own External Method by just this code
snipped (please note: there is no string 'bland.gif' in it - it was just in
my former broken code)  I get the very same error message with the missing
file 'bland.gif'.  It seems that there is something cached and I would
like to know how to get the changed version into this cache.  Moreover
it would be nice to enlighten me about some other way to reference
files in the same ZMI folder from External Methods besides this way
to ship a parameter.

Kind regards

        Andreas.