Custom tool error

2227
3
05-23-2016 04:34 AM
SadanandacharB1
New Contributor III

Hi All

      As suggestions given in the blog i modified the script, But still i am getting the same error please help me

when i run the script in python editor with workspaces hardcoded like below, the code executes properly.

import arcpy

... import os

... from arcpy import env

... env.overwriteOutput = True

... env.workspace = "D:/Python DVD/Python/Data/Exercise02"

... outgdb = "D:/Data/Test1.gdb"

... print outgdb

... fclist = arcpy.ListFeatureClasses()

... for fc in fclist:

...     fcdesc = arcpy.Describe(fc)

        print fcdesc.baseName

        print  os.path.join(outgdb, fcdesc.baseName)

...     arcpy.CopyFeatures_management(fc, os.path.join(outgdb, fcdesc.baseName))

But when i create custom tool using this script i am getting the error

import arcpy

import os

from arcpy import env

env.overwriteOutput = True

env.workspace = arcpy.GetParameterAsText(0)

outgdb = arcpy.GetParameterAsText(1)

print outgdb

fclist = arcpy.ListFeatureClasses()

for fc in fclist:

    fcdesc = arcpy.Describe(fc)

    print fcdesc.baseName

    print  os.path.join(outgdb, fcdesc.baseName)

    arcpy.CopyFeatures_management(fc, os.path.join(outgdb, fcdesc.baseName))

Error is:

Test.jpg

  

test1.jpg

0 Kudos
3 Replies
FC_Basson
MVP Regular Contributor

Ensure that your Geoprocessing environment is configured to allow output overwrite

Overwrite Outputs

SadanandacharB1
New Contributor III

Thank you very very much

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

This thread is in essence a duplicate of this thread Error when running custom script tool

and overwriteoutputs was suggested as well.

Respond to the suggestions in one thread as to whether they worked or not before starting a duplicate.

Could you provide more print statements in your code so people can accurately assess what your inputs and outputs are.