Hash: SHA1

- --On 23. Dezember 2006 22:27:29 -0800 Allen Huang <[EMAIL PROTECTED]> wrote:

> 2. but when I save the shapefiles (taiwan1.shp, taiwan1.shx, taiwan1.dbf)
> into zope and call it using dtml it return the same error message.
> import shapelib, dbflib
>         def readshp(filename):
>             shp = shapelib.ShapeFile(filename)
>             return shp.info()
>         and in zope
>         <dtml-var expr="readshp(taiwan1.shp)">
>                 or
>         <dtml-var expr="readshp('http://localhost/pytest/taiwan1.shp')">

No idea what shapelib is doing but reading a file from the locale 
filesystem as it seems to work from an external method is *different* from 
a accessing
content that is stored within the ZODB. I really wonder why you think it 
would work the same way? The hierarchical object storage of Zope looks 
similar to a filesystem but it is not a filesystem and the Python APIs for 
accessing filesystems don't apply. We have no idea what the ShapeFile 
constructors expects as data. If it expects a filename of a file within the 
filesystem then you must obtain the content of your data stored within the 
ZODB, create a temporary file and call the constructor as you did within
your external method. Possibly the constructor accepts the data directly
as *string*..in this case this would make things a bit easier. But it is up 
to *you* to check the Shapelib API and take appropriate action.

- -aj
Version: GnuPG v1.4.6 (Darwin)


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

Reply via email to