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
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))
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")
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
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)
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 Unic
ode:
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.
_______________________________________________ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
