floryar

UpdateCursor 'skip optional parameters' not working...

Discussion created by floryar on Aug 6, 2012
Latest reply on Aug 15, 2012 by jskinner-esristaff
Hi,

I'm using Python code in PyScripter with ArcGIS 10.0 to step through rows using an UpdateCursor, however I cannot get it to skip over optional parameters. 

UpdateCursor takes: UpdateCursor (dataset, {where_clause}, {spatial_reference}, {fields}, {sort_fields}).  I am interested in setting the 'dataset' (required) and 'fields' (optional) only, and I have tried the following three methods as suggested on the ArcGIS 10.0 help site:

cur1 = arcpy.UpdateCursor("InputLyr","","",["UnqRecordI","UnqWellLoc"])
cur1 = arcpy.UpdateCursor("InputLyr","#","#",["UnqRecordI","UnqWellLoc"])
cur1 = arcpy.UpdateCursor("InputLyr",fields=["UnqRecordI","UnqWellLoc"])


All three result in errors: "Object: Error in parsing arguments for UpdateCursor" for the first two, and "UpdateCursor() got an unexpected keyword argument 'fields'" for the third. 

I cannot for the life of me figure out what could be wrong with the parsing.  Your help/suggestions would be greatly appreciated!

Thanks in advance!

Outcomes