Thanks a lot for replying... I still a newbie at this ... 
in order for shapelib to read shapefile, you need a set of three files(.shp, 
.shx, .dbf).

so, if I have to download this to a temp location into my computer filesystem, 
could you show me how this is done? 


----- Original Message ----
From: Andreas Jung <[EMAIL PROTECTED]>
To: Allen Huang <[EMAIL PROTECTED]>; Zope <zope@zope.org>
Sent: Sunday, December 24, 2006 2:47:52 PM
Subject: Re: Fw: [Zope] problem with the shapelib module.. help


-----BEGIN PGP SIGNED MESSAGE-----
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFFjiKYCJIWIbr9KYwRAk0oAKCSyEo5ykswElgi9jFGWf89NthzmwCfRvEM
nSMyeIu/cK7NpecUlof2BR8=
=B0Mw
-----END PGP SIGNATURE-----

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to