999999 Error

Discussion created by djriff on Nov 29, 2011
Latest reply on Dec 12, 2011 by djriff
Hey everyone, i've been writing and rewriting this script for the past couple of days. A problem I ran into was it would error out if a field already existed, thus the if x etc came into play. Now the problem i'm running into is for some reason right after it posts the message Calculating Fields, it gives me the 999999 error. I'm testing it on a file geodatabase with 1 feature class in it with 8 features. here is my script.

import arcpy
DSETS = arcpy.GetParameterAsText(0)
SEC = arcpy.GetParameterAsText(1)
ODATE = arcpy.GetParameterAsText(2)
SINFO = arcpy.GetParameterAsText(3)
UDATE = arcpy.GetParameterAsText(4)

arcpy.env.workspace = DSETS
fclist = arcpy.ListFeatureClasses()
arcpy.AddMessage("Feature Classes Listed")
x = False
y = False
z = False
a = False
b = False
arcpy.AddMessage("Checking to see if metadata fields exist")
for fc in fclist:
  arcpy.MakeFeatureLayer_management(fc, "fc_layer")
  lfields = arcpy.ListFields(fc)
  for field in lfields:
    if = "SEC_CLASS":
      x = True
  if x <> True:
    arcpy.AddField_management("fc_layer", "SEC_CLASS", "TEXT", "", "", 50, "", "NULLABLE", "", "")
    arcpy.addMessage("SEC_CLASS added")
  arcpy.AddMessage("SEC_CLASS checked")
  for field in lfields:
    if = "ORIG_SOURCE_DATE":
      y = True
  if y <> True:
    arcpy.AddField_management("fc_layer", "ORIG_SOUCE_DATE", "DATE", "", "", 50, "", "NULLABLE", "", "")
    arcpy.addMessage("ORIG_SOURCE_DATE added")
  arcpy.AddMessage("ORIG_SOURCE_DATE checked")
  for field in lfields:
    if = "ORIG_SOURCE_INFO":
      z = True
  if z <> True:
    arcpy.AddField_management("fc_layer", "ORIG_SOURCE_INFO", "TEXT", "", "", 50, "", "NULLABLE", "", "")
    arcpy.addMessage("ORIG_SOURCE_INFO added")
  arcpy.AddMessage("ORIG_SOURCE_INFO checked")
  for field in lfields:
      a = True
  if a <> True:
    arcpy.AddField_management("fc_layer", "UPDATE_SOURCE_DATE", "DATE", "", "", 50, "", "NULLABLE", "", "")
    arcpy.addMessage("UPDATE_SOURCE_DATE added")
  arcpy.AddMessage("UPDATE_SOURCE_DATE checked")
  for field in lfields:
    if = "COUNTRY_CODE":
      b = True
  if b <> True:
    arcpy.AddField_management("fc_layer", "COUNTRY_CODE", "TEXT", "", "", 50, "", "NULLABLE", "", "")
    arcpy.addMessage("COUNTRY_CODE added")
  arcpy.AddMessage("COUNTRY_CODE checked")
  arcpy.AddMessage("Calculating fields")
  rows = arcpy.UpdateCursor("fc_layer","","","")
  for row in rows:
    row.SEC_CLASS = SEC

any ideas on why this is happening? i have a model builder equivalent to this already build but I prefer python as it is much faster for the amount of data I need to process.