shapelib still didn't work for me.. help
 
I've being trying different things for the pass day
 
1. I put the shapefile directly in the Extensions with the external method and 
it work fine
        import shapelib, dbflib
        def readshp():
            shp = shapelib.ShapeFile('taiwan1.shp')
            return shp.info()

           and in zope
            <dtml-var expr="readshp()>
 
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')">


The error message are

1. in "Run Zope in Console"
        Exception exceptions.AttributeError:"ShapeFile instance has no 
attribute 'thisown'" in     ignored
 
2. in web browser
    Site Error
    An error was encountered while publishing this resource. 
    Error Type: IOError
    Error Value: new_ShapeFile failed

 
is there something wrong with how I constructed it? Do I need to do something 
before hand?

3. in error_log
Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 41, in call_object
  Module OFS.DTMLMethod, line 143, in __call__
   - <DTMLMethod at /testPython/test>
   - URL: http://localhost/testPython/test/manage_main
   - Physical Path: /testPython/test
  Module DocumentTemplate.DT_String, line 476, in __call__
  Module DocumentTemplate.DT_Util, line 196, in eval
   - __traceback_info__: readshp
  Module <string>, line 1, in <expression>
  Module Products.ExternalMethod.ExternalMethod, line 231, in __call__
   - __traceback_info__: (('http://localhost/testPython/taiwan1.shp',), {}, 
None)
  Module C:\web\ZopeInstance\Extensions\shapetools.py, line 4, in readshp
  Module shapelib, line 44, in __init__
IOError: new_ShapeFile failed





----- Forwarded Message ----
From: Dieter Maurer <[EMAIL PROTECTED]>
To: Allen Huang <[EMAIL PROTECTED]>
Cc: Zope <zope@zope.org>
Sent: Saturday, December 23, 2006 3:52:53 AM
Subject: Re: [Zope] problem with the shapelib module.. help


Allen Huang wrote at 2006-12-21 23:23 -0800:
>I want to do some mapping application with zope.. but I have run into this 
>problem over and over..
>
>in "Run Zope in Console"
>Exception exceptions.AttributeError:"ShapeFile instance has no attribute 
>'thisown'" in     ignored

Hmm. I doubt that you have really seen this text. There should be something
in between the "in" and the "ignored". It is *vital* that you
are as precise as possible in your problem reports...


Python emits messages of the kind above in some (rare) situations,
e.g. when exceptions occur in destructors.


The exception above seems to have been raised in such a situation.
The missing thing betwenn "in" and "ignored" should tell us which situation
this was.

It tells you that something tries to access the attribute "thisown"
on a "ShapeFile" instance but this does not have the attribute.

>
>in web browser
>Site Error
>An error was encountered while publishing this resource. 
>Error Type: IOError
>Error Value: new_ShapeFile failed


Another tip for the future. When you report problems, you need
to include full error information. Beside the "Error Type" and
"Error Value" above, this also includes the traceback.
You find all this information in the "error_log" object in
Zope's "Root Folder" (Management Interface).



-- 
Dieter

__________________________________________________
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