AnsweredAssumed Answered

I am learning python from a book, programming python with arcgis 10.1  I did everything from Chapter 7 but I have a mistake.  Here is the code  import arcpy, os try:   outputFC = arcpy.GetParameterAsText(0) fClassTemplate = arcpy.GetParameterAsText(1)   f

Question asked by Alesger_19801107 on Apr 7, 2016
Latest reply on Apr 10, 2016 by Playa

I am learning python from a book, programming python with arcgis 10.1

I did everything from Chapter 7 but I have a mistake.

Here is the code

 

import arcpy, os
try:
  outputFC = arcpy.GetParameterAsText(0)
fClassTemplate = arcpy.GetParameterAsText(1)
  f = open(arcpy.GetParameterAsText(2),'r')
arcpy.CreateFeatureclass_management(os.path.split(outputFC)
[0], os.path.split(outputFC[1]), "point", fClassTemplate)
  lstFires = f.readlines()
  cur = arcpy.InsertCursor(outputFC)
  cntr = 1
  for fire in lstFires:
  if 'Latitude' in fire:
  continue
  vals = fire.split(",")
  latitude = float(vals[0])
  longitude = float(vals[1])
  confid = int(vals[2])
  pnt = arcpy.Point(longitude, latitude)
  feat = cur.newRow()
  feat.shape = pnt
  feat.setValue("CONFIDENCEVALUE", confid)
  cur.insertRow(feat)
  arcpy.AddMessage("Record number: " + str(cntr) + " written to
feature class")
  cntr = cntr + 1
except:
  print arcpy.GetMessages()
finally:
  del cur
  f.close()

But when I run the Code I get mistake which connect del cur.

And I do not understand why I get this mistake.

Outcomes