[Zope] want to use external script to read a text-file and image in
database and modify REQUEST
Allen Huang
swapp0 at yahoo.com
Sat Feb 25 02:32:54 EST 2006
Hi
I want to use external methods to read a text file and image in database and modify the REQUEST
my code looks like this varible
-----------------------
def imageSetup(self, imageID, dataID, REQUEST):
import PIL.Image
from StringIO import StringIO
# Get the original image and data in memory.
image=getattr(self, imageID)
imageData=getattr(self, dataID)
imageFile=StringIO(str(image.data))
imageDataFile=StringIO(str(imageData.data))
# open image and data file
im = PIL.Image.open(imageFile)
tfw = open(imageDataFile, "r")
# assign data coordinate and image size to variables
imX,imY = im.size()
rX=float(tfw.readline())
tfw.readline()
tfw.readline()
rY=float(tfw.readline())
mnX=float(tfw.readline())
mnY=float(tfw.readline())
mxX=mnX+imX*rX
mxY=mnY+imY*rY
# assign variables to REQUEST
REQUEST.set('resX', rX)
REQUEST.set('resY', rY)
REQUEST.set('minX', mnX)
REQUEST.set('minY', mnY)
REQUEST.set('maxX', mxX)
REQUEST.set('maxY', mxY)
REQUEST.set('pixelX', imX)
REQUEST.set('pixelY', imY)
--------------------------------------
but all I get is this
zope coercing to Unicode: need string or buffer, instance found
and the REQUEST variable is unchanged
I'm still new to external scripting so I don't know what the problem is
(and I think there is a lot of it here)
so, could someone help me out??
---------------------------------
Yahoo! Mail
Use Photomail to share photos without annoying attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20060224/2b19d351/attachment.htm
More information about the Zope
mailing list