COMObject unknown

    Table of contents
    1. 1. Case A
    2. 2. Case B

    Version as of 01:34, 15 Jan 2012

    to this version.

    Return to Version archive.

    View current version

    I've been experimenting with running parallel OSGeo4W and ArcGIS as well as shared python installs for a few years. Today I discovered a circumstance where that until-now happy union has a problem. Curiously it's not clear where/whose fault it is.

    Case A

    import arcgisscripting
    gp = arcgisscripting.create(9.3)
    
    #List workspaces in D:\GIS
    gp.Workspace = "D:\GIS"
    wss = gp.ListWorkspaces("*","All")
    ws = wss.Next()
    while ws:
        print ws
        ws = wss.Next()

     

    If I'm using the ArcGIS python the result is:

    Traceback (most recent call last):
       File "xxx.py", line 10, in <module>
        ws = wss.Next()
    AttributeError: 'list' object has no attribute 'Next'

     

    While o4w python is:

    D:\GIS\ag-canada
    D:\GIS\AK-elev
    D:\GIS\AlaskaYukon
    ...
    D:\GIS\Planimetric250k
    D:\GIS\Snippets
    D:\GIS\Tissots
    D:\GIS\yt30mdem
    

     

    Needless to say, in this instance o4w is the desired result.

    Case B

    import arcgisscripting
    gp = arcgisscripting.create(9.3)
    
    # report attribute names for specified feature class
    fc = '../scratch/nts_grid.shp'
    try:
        print '%s fields are' % (fc)
        for field in gp.ListFields(fc):
            print field.Name
    except:
        print gp.GetMessages(2)
    

     

    Output with ArcGIS python:

    ../scratch/nts_grid.shp fields are
    FID
    Shape
    CODE
    ACCURACY
    VALDATE
    FLOODED
    TILING
    Shape_Leng
    Shape_Area

     

    and o4w python:

    ../scratch/nts_grid.shp fields are
    
    
    
        Send feedback