Hello there,
I have been trying for a while to use both Local File system objects and external methods.
I need to get the file path of my LocalFS image. But it seems I cannot apply ._local_path to these kind of objects.
File C:\TestRes\lib\python\DocumentTemplate\VSEval.py, line 175, in __init__
(Object: Imagenes['logo.gif']._local_path)
TypeError: illegal name used in expression
Meanwhile I tried to explicitly pass the file location to my external method
Where my external method is:
#minipil.py
import Image
def conversion(a):
im = Image.open(a)
return im.format
Error Type: IOError
Error Value: [Errno 22] Invalid argument: "c:\\TestRes\\images\\logo.gif/"
Traceback (innermost last):
File C:\TestRes\lib\python\ZPublisher\Publish.py, line 222, in publish_module
File C:\TestRes\lib\python\ZPublisher\Publish.py, line 187, in publish
File C:\TestRes\lib\python\Zope\__init__.py, line 221, in zpublisher_exception_hook
(Object: Traversable)
File C:\TestRes\lib\python\ZPublisher\Publish.py, line 171, in publish
File C:\TestRes\lib\python\ZPublisher\mapply.py, line 160, in mapply
(Object: Prueba)
File C:\TestRes\lib\python\ZPublisher\Publish.py, line 112, in call_object
(Object: Prueba)
File C:\TestRes\lib\python\OFS\DTMLMethod.py, line 172, in __call__
(Object: Prueba)
File C:\TestRes\lib\python\DocumentTemplate\DT_String.py, line 528, in __call__
(Object: Prueba)
File C:\TestRes\lib\python\DocumentTemplate\DT_Let.py, line 147, in render
(Object: imagen="Imagenes['logo.gif'].basepath")
File C:\TestRes\lib\python\DocumentTemplate\DT_Util.py, line 337, in eval
(Object: minipil('c:\TestRes\images\logo.gif'))
(Info: minipil)
File <string>, line 0, in ?
File C:\TestRes\lib\python\Products\ExternalMethod\ExternalMethod.py, line 263, in __call__
(Object: minipil)
(Info: (('c:\\TestRes\\images\\logo.gif',), {}, None))
File C:\TestRes\Extensions\minipil.py, line 8, in conversion
File \\lon-integtest01\C\TestRes\bin\PIL\Image.py, line 887, in open
File C:\TestRes\lib\python\App\ImageFile.py, line 110, in __init__
IOError: (see above)
The idea is to use PIL to convert images from bmp to gif. This is working fine, the Image module is finally working in Zope. But I cannot go on until I find out the way to access those images through the external method. That is why now the only thing I do with my method is to return the image format. To keep things simple...and try to find out what is failing.

Anyway...can someone help me with this, please?

Thanks a lot.

Belen

Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.