Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Creating Feature Class in ArcPy gives RuntimeError?

$
0
0

I am new to Python.

I am trying to create a new Feature Class within a long script but before I do so, I am running it separately to make sure I have the syntax correct.
The code below mimics the one in the ESRI help documentation.

# create new featureclass in which to put points
import arcpy

arcpy.env.workspace = "C:/Test2"


out_path = "C:/Test2/GIS"
out_name = "RhinoLines.shp"
geometry_type = "POLYLINE"
spatial_reference = arcpy.Describe("C:/Test2/GIS/RhinoTracks.shp").spatialReference
print spatial_reference.Name

if arcpy.Exists(out_name):
    arcpy.Delete_management(out_name)

else:
    arcpy.CreateFeatureclass_management(out_path, out_name, geometry_type, spatial_reference)

But I keep getting this error:

  GCS_WGS_1984
Traceback (most recent call last):
  File "C:Python27ArcGIS10.3Libsite-packagespythonwinpywinframeworkscriptutils.py", line 326, in RunScript
    exec codeObject in __main__.__dict__
  File "C:Test2Scriptsstupid.py", line 20, in <module>
    arcpy.CreateFeatureclass_management(out_path, out_name, geometry_type, spatial_reference)
  File "C:Program Files (x86)ArcGISDesktop10.3ArcPyarcpymanagement.py", line 1807, in CreateFeatureclass
    raise e
RuntimeError: Object: Error in executing tool

Viewing all articles
Browse latest Browse all 767

Trending Articles