arcpy.Append_management throws exception

125
0
11-05-2019 05:02 AM
leonoestergaard
New Contributor III

My mission is to add this specific point (

arcpy.Point(495880.110399999666220115.4076000005,-99)

)

to a feature class, the fc are a part of a geometric network

I cannot use the arcpy.da.insert cursor due to Bug NIM102778

So first i create a new feature class which is not a part of a geometric network like this:

spatial_ref = arcpy.Describe("ELDB.EL.MUFFE").spatialReference    fc = arcpy.CreateFeatureclass_management(r"C:\Connections\GISProddb\Schema\El@ProdDB.sde\ELDB.EL.El""MyTempFeatureClass",  "Point","ELDB.EL.MUFFE",None,"ENABLED",spatial_ref)

 And inserts into the new class like this

point2 = arcpy.Point(495880.110399999666220115.4076000005,-99)
pt2= arcpy.PointGeometry(point2,spatial_ref) 

icursor = arcpy.da.InsertCursor(fc,["SHAPE@","SNCode","RMCode","LCCode","OMCode","Enabled","MACode","ADate","Comment"]) 

icursor.insertRow([pt2,"10000",0,1,0,1,3,datetime.datetime.now(),"Created from TestScript"])
del icursor

At this point Im able to find the MyTempFeatureClass and the inserted point in ArcMap

Now its time to append the point into thw feature class in the geometric network

Im doing it like this

edit = arcpy.da.Editor(r"C:\Connections\GISProddb\Schema\El@ProdDB.sde")
edit.startEditing(FalseTrue)  
edit.startOperation()  
try:
    arcpy.Append_management (r"C:\Connections\GISProddb\osa\El@ProdDB.sde\ELDB.EL.MyTempFeatureClass"r"C:\Connections\GISProddb\osa\El@ProdDB.sde\ELDB.EL.MUFFE",'NO_TEST')
except Exception as e:
    pass
finally:
    edit.stopOperation()        
    edit.stopEditing(True)  
 

The exception is:

ERROR 000372: Spatial Reference for output is invalid, Please update to allow output to become valid\nFailed to

execute (Append).\n' 

Any ideas on what is happening?

0 Kudos
0 Replies