Hi Zopians out there,

thanks for helping me with my last question - here is a new one ;-)

We do image-processing of traffic-video-sequences and I'd like to serve 
thumbnails use the following code (originally from some HOW-TO) as external 

import os, os.path, Image

def get_image(self, imagename, thumb, REQUEST, RESPONSE):
    Read and return an external file with appropriate response set.
    Returns the contents of the file or image.  Also, sets the
    Content-Type HTTP header to the objects content type.
    thumbname = os.path.join('/tmp', 'thumbs', imagename)
    imagename = os.path.join('/tmp', 'images', imagename)
    print 'i:', imagename
    print 't:', thumbname
    if not os.path.exists(imagename):
        return ""
    if thumb == '1':
        print 'inner'
        if not os.path.exists(thumbname):
            print 'inner2'
            #img = Image.open(imagename) <-- if I remove the comment, the 
'inner2' is still printed, but the 'after open' in the next line is not printed 
in the logfile anymore
            print 'after open',img, type(img),'di'
            print img.size
            print 'later'
        imagename = thumbname
    fptr=open(imagename, "rb")
    RESPONSE.setHeader("Content-Type", "image/png")
    RESPONSE.setHeader("Content-Length", size)
    return data

My questions are:
- Does anybody have a clue, why the 'after open' and the next two prints are 
not printed in the log file (I thing /var/log/zope) when I uncomment the line 
- If it is some error within python and/or the PIL, how do I get the error 
output out of zope (I couldn't find this in the docu yet). The strange thing 
is, the request is served, but the lines

            print 'after open',img, type(img),'di'
            print img.size
            print 'later'

seem to be simply ignored when uncommenting the "img = Image.open(..." line. 
BTW, I can execute the PIL-commands in the normal python-shell without any 

Thanks for any hint.

        Tilo Schwarz

DaimlerChrysler AG, Research & Technology
Image Understanding FT3/AB
Dr. Tilo Schwarz
Tel:    +49-731-505-2376
Fax:    +49-731-505-4105
P.O.Box 2360, 89013 Ulm, Germany

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to