vba_try_hard

Python parameter syntax problem

Discussion created by vba_try_hard on Nov 9, 2010
Latest reply on Nov 9, 2010 by s.offermannconterra-de-esridist
Hi all

Not a hard one but I can't figure it out. I cannot get the SelectLayerByAttribute whereclause to fire in this pretty simple Python script. I have exhausted all my known possibilities and now I'm exhausted abd very frustrated. If I comment this line out completely then the script works fine and I get my copied features in the outfc but the SelectLayerByAttribute will not run for the want of trying.

I am trying to select the largest area count and copy this selected record into the outfc.

import arcgisscripting
gp = arcgisscripting.create(9.3)
gp.overwriteoutput = 1

try:
    gp.workspace = "C://Temp"
    infc = gp.workspace + "//polys.shp"
    outfc = "polys1.shp"
    gp.createfeatureclass(gp.workspace,outfc,"POLYGON",infc)
    gp.selectlayerbyattribute(infc,"NEW_SELECTION", "MAX("AREA")")
    gp.copyfeatures(infc,outfc)
except:
    print "error"

Thanks

Chris

Attachments

Outcomes