[Zope] HELP:File Path.
Belen Ares-Paredes
baresp@hotmail.com
Mon, 19 Feb 2001 11:18:47 +0100
<html><DIV>Hello there, </DIV>
<DIV></DIV>I have been trying for a while to use both Local File system objects and external methods.
<DIV></DIV>
<DIV></DIV>I need to get the file path of my LocalFS image. But it seems I cannot apply ._local_path to these kind of objects.
<DIV></DIV>
<DIV></DIV><DTML-LET imagen="Imagenes['logo.gif']._local_path">
<DIV></DIV>
<DIV></DIV>File C:\TestRes\lib\python\DocumentTemplate\VSEval.py, line 175, in __init__
<DIV></DIV>(Object: Imagenes['logo.gif']._local_path)
<DIV></DIV>TypeError: illegal name used in expression
<DIV></DIV>
<DIV></DIV>Meanwhile I tried to explicitly pass the file location to my external method
<DIV></DIV>
<DIV></DIV><DTML-VAR ?minipil(?c:\TestRes\images\logo.gif?)?>
<DIV></DIV>
<DIV></DIV>Where my external method is:
<DIV></DIV>
<DIV></DIV>#minipil.py
<DIV></DIV>import Image
<DIV></DIV>
<DIV></DIV>def conversion(a):
<DIV></DIV>
<DIV></DIV>im = Image.open(a)
<DIV></DIV>return im.format
<DIV></DIV>
<DIV></DIV>Error Type: IOError
<DIV></DIV>Error Value: [Errno 22] Invalid argument: "c:\\TestRes\\images\\logo.gif/"
<DIV></DIV>
<DIV></DIV>Traceback (innermost last):
<DIV></DIV>File C:\TestRes\lib\python\ZPublisher\Publish.py, line 222, in publish_module
<DIV></DIV>File C:\TestRes\lib\python\ZPublisher\Publish.py, line 187, in publish
<DIV></DIV>File C:\TestRes\lib\python\Zope\__init__.py, line 221, in zpublisher_exception_hook
<DIV></DIV>(Object: Traversable)
<DIV></DIV>File C:\TestRes\lib\python\ZPublisher\Publish.py, line 171, in publish
<DIV></DIV>File C:\TestRes\lib\python\ZPublisher\mapply.py, line 160, in mapply
<DIV></DIV>(Object: Prueba)
<DIV></DIV>File C:\TestRes\lib\python\ZPublisher\Publish.py, line 112, in call_object
<DIV></DIV>(Object: Prueba)
<DIV></DIV>File C:\TestRes\lib\python\OFS\DTMLMethod.py, line 172, in __call__
<DIV></DIV>(Object: Prueba)
<DIV></DIV>File C:\TestRes\lib\python\DocumentTemplate\DT_String.py, line 528, in __call__
<DIV></DIV>(Object: Prueba)
<DIV></DIV>File C:\TestRes\lib\python\DocumentTemplate\DT_Let.py, line 147, in render
<DIV></DIV>(Object: imagen="Imagenes['logo.gif'].basepath")
<DIV></DIV>File C:\TestRes\lib\python\DocumentTemplate\DT_Util.py, line 337, in eval
<DIV></DIV>(Object: minipil('c:\TestRes\images\logo.gif'))
<DIV></DIV>(Info: minipil)
<DIV></DIV>File <string>, line 0, in ?
<DIV></DIV>File C:\TestRes\lib\python\Products\ExternalMethod\ExternalMethod.py, line 263, in __call__
<DIV></DIV>(Object: minipil)
<DIV></DIV>(Info: (('c:\\TestRes\\images\\logo.gif',), {}, None))
<DIV></DIV>File C:\TestRes\Extensions\minipil.py, line 8, in conversion
<DIV></DIV>File \\lon-integtest01\C\TestRes\bin\PIL\Image.py, line 887, in open
<DIV></DIV>File C:\TestRes\lib\python\App\ImageFile.py, line 110, in __init__
<DIV></DIV>IOError: (see above)
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>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.
<DIV></DIV>
<DIV></DIV>
<P>Anyway...can someone help me with this, please?</P>
<P>Thanks a lot. </P>
<DIV></DIV>
<DIV></DIV>Belen<br clear=all><hr>Get Your Private, Free E-mail from MSN Hotmail at <a href="http://www.hotmail.com">http://www.hotmail.com</a>.<br></p></html>