Error saving object from python script using GetParameterAsText

المشرف العام

Administrator
طاقم الإدارة
I have a script that takes in a line, and creates a certain polygon based on this.

My code obtaining the input information is as follows:

inFC = arcpy.GetParameterAsText(0)hasClearway = arcpy.GetParameterAsText(1) hasHighDivergence = arcpy.GetParameterAsText(2)outFC = arcpy.GetParameterAsText(3)fcName = outFC.rpartition("\\")[2]fcPath = outFC.rpartition("\\")[0]outFC = arcpy.CreateFeatureclass_management(fcPath, fcName, "POLYGON", inFC, "DISABLED", "DISABLED", inFC)The polygon is finally created from an array and inserted into outFC

runwaypolygon = arcpy.Polygon(polygon_array)cursor = arcpy.da.InsertCursor(outFC, ['SHAPE@'])cursor.insertRow([runwaypolygon])However I am getting the error 20469, "An Error Occured trying to save the object named X". I have looked into this http://support.esri.com/de/knowledgebase/techarticles/detail/20469but this has not shed any light on the issue. Two further points:

(1) I have successfully used this method with an object of exactly the same type (a polygon produced in the same way).

(2) The script works fine when I ask the user to specify output file location and name separately, as here:

inFC = arcpy.GetParameterAsText(0)hasClearway = arcpy.GetParameterAsText(1)hasHighDivergence = arcpy.GetParameterAsText(2)outFC_location = arcpy.GetParameterAsText(3)fcName = (arcpy.GetParameterAsText(4))outFC = arcpy.CreateFeatureclass_management(outFC_location, fcName, "POLYGON")What is the error in my code or my approach?



أكثر...
 
أعلى