[Zope] Photo Product: Can't convert images.

Mark Simpson zdp@bowfort.com
Fri, 25 Jan 2002 21:38:53 -0700


Hi,

I'm using the Photo Folder product, and I'm trying to convert a number of 
jpg's by using the "Python Script" shown in the README.txt for the product:

"""Convert all Image objects in folder to Photo objects"""

for image in context.objectValues(['Image']):
  context.manage_delObjects([image.getId(),], REQUEST=context.REQUEST)
  context.manage_addProduct['Photo'].manage_addPhoto(image.getId(),
                     image.title, image.data, REQUEST=context.REQUEST)


I get the following error when calling the Image2Photo script on the folder:

Error Type: AttributeError
Error Value: 'string' object has no attribute 'read'

<!--

Traceback (innermost last):
  File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line 223, in 
publish_module
  File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line 187, in publish
  File /usr/local/Zope/lib/python/Zope/__init__.py, line 221, in 
zpublisher_exception_hook
    (Object: Traversable)
  File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line 171, in publish
  File /usr/local/Zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
    (Object: Image2Photo)
  File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line 112, in 
call_object
    (Object: Image2Photo)
  File /usr/local/Zope/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in 
__call__
    (Object: Image2Photo)
  File /usr/local/Zope/lib/python/Shared/DC/Scripts/Bindings.py, line 354, in 
_bindAndExec
    (Object: Image2Photo)
  File /usr/local/Zope/lib/python/Products/PythonScripts/PythonScript.py, 
line 336, in _exec
    (Object: Image2Photo)
    (Info: ({'script': <PythonScript instance at 8b81a20>, 'context': 
<PhotoFolder instance at 8c3cc60>, 'container': <CMFSite instance at 
8dcdfc0>, 'traverse_subpath': []}, (), {}, None))
  File Script (Python), line 7, in Image2Photo
    (Object: DSC00350.JPG)
  File /var/zope/Products/Photo/Photo.py, line 654, in manage_addPhoto
AttributeError: (see above)

-->
 
And line 654 in Photo.py is 
 photo._data = file.read()    in manage_addPhoto python method.

I'm using ExtFile and the ImageMagick engine.

Can anyone see what I'm doing wrong, or what I need to fix?

Thanks
Regards
Mark Simpson