AnsweredAssumed Answered

ERROR 001156 on CopyFeatures_management

Question asked by jamesfreddyc Champion on Mar 4, 2020
Latest reply on Mar 4, 2020 by jamesfreddyc

Hi all,


Not sure what I missing here.  I am creating in_memory feature layer from the result of a arcpy.Intersect_analysis() operation and then attempting to apply CopyFeatures on that feature layer (it has an sql applied to it in order to filter prior to CopyFeatures).


Of note in code below: setting up itsctRESULT variable to output to disk and everything works but fails with said Error when set to output to in_memory.


I'd rather have it all operate in the in_memory workspace as it saves a bathtub full of processing time.


landFC = os.path.join("in_memory", "landsToProc")
arcpy.JSONToFeatures_conversion(jFileLands, landFC)

trackFC = os.path.join("in_memory", "tracksToProc")
arcpy.JSONToFeatures_conversion(jFileTracks, trackFC)

itsctRESULT = os.path.join(r"in_memory", "itsctRESULT")
#itsctRESULT = os.path.join(r"E:\someFolder", "itsctRESULT") <-doesn't cause error 001156 at CopyFeatures_management line below

arcpy.Intersect_analysis(["tracksToProc","landsToProc"], itsctRESULT, "ALL", "#", "POINT")

arcpy.AddField_management(itsctRESULT,'rel_objectid', "LONG")
arcpy.AddField_management(itsctRESULT,'PO', "TEXT", 50)

with arcpy.da.UpdateCursor(itsctRESULT,updFields) as cursor:
     for row in cursor:
          row[0] = purchaseOrder
          row[1] = vendorNumber
inputFL = os.path.join("in_memory","fl_{0}".format(count))
outputFL = os.path.join("in_memory", "flResult_{0}".format(count))

sql = "Some Where Clause that filters correctly"
arcpy.MakeFeatureLayer_management(itsctRESULT, inputFL, sql)
arcpy.CopyFeatures_management(inputFL, outputFL) <- fails with ERROR 001156: Failed on input OID 1, could not write value '4500321321' to output field PO