0

The following code won't work when I try to use it for a custom tool to transform shapefiles into a geodatabase. I get the following error message.

Traceback (most recent call last): File "C:\ line 13, in arcpy.CopyFeatures_management(fc, outfc) File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\management.py", line 2335, in CopyFeatures raise e ExecuteError: ERROR 000210: Cannot create output Failed to execute (CopyFeatures).

Failed to execute (CopyFeatures).

The code is:

import arcpy
import os
from arcpy import env
env.workspace = arcpy.GetParameterAsText(0)
outworkspace = arcpy.GetParameterAsText(1)
fclist = arcpy.ListFeatureClasses()
fcount = len(fclist)
arcpy.SetProgressor("step", "Copying shapefiles", 0, fcount, 1)
for fc in fclist:
    arcpy.SetProgressorLabel("copying " + fc)
    fcdesc = arcpy.Describe(fc)
    outfc = os.path.join(outworkspace, fcdesc.baseName)
    arcpy.CopyFeatures_management(fc, outfc)
    arcpy.SetProgressorPosition()
arcpy.ResetProgressor()
  • 1
    Does your shapefile really have space in it's name? – FelixIP Mar 26 '18 at 3:13
  • Is there a schema lock on the output? Does it exist already and is open somewhere? – Fezter Mar 26 '18 at 3:20
  • Not sure what is meant by the space in the name? – user10720 Mar 26 '18 at 3:27
  • 3
    Is this relevant? – Fezter Mar 26 '18 at 3:28
  • 2
    Try to change the dash (-) in 2017-2018 to underscore and run the tool. – ahmadhanb Mar 26 '18 at 5:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.