jazmateta

Using geoprocessing tools in Python script that give warning and NO data

Discussion created by jazmateta on Aug 3, 2011
Part of the script that I am writing is to take the geocoded results and copy them both to an existing yearly file and to a file that is stamped with the date run and the userid.  Both of these will 'create' in the file geodatabase but both return the WARNING 000117:  Warning empty output generated.
I have checked the spatial reference for both the copied from the original feature class and the newly created feature class and both are the SAME as the geocoded results file.  I would expect to get this warning on the one that I am running fc2fc using an empty template for, but not for the one that I am appending data to a direct copy of the original.
The if..else section criteria about the arcpy.exists will be changed in the future, I just want it to work right now.

Python code snippet:

# import
import arcpy, time, datetime, getpass

#getting current time and user
now = datetime.datetime.today()
date_stamp = now.strftime("%m%d%Y")
maintid = getpass.getuser()
curyear = now.strftime("%Y")

#variables
wksp = arcpy.env.workspace = (r"j:\NewData.gdb")
mxd = arcpy.mapping.MapDocument(r"j:\mxdfiles\NewData.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
saveGeocode = arcpy.GetParameterAsText(0)
outFile = r"\FeatTable_"+maintid+"_"+date_stamp
yearlyFile = wksp+"\FeatTable"+curyear+"_"+maintid
curGeocode = wksp+outFile
templateFC = wksp+"\FCTemplate"

#Set up the env
#arcpy.env.overwriteOutput = True

if saveGeocode == 'Y' or saveGeocode == 'y':
    layer2manipulate = arcpy.mapping.ListLayers(mxd,"FeatTable",df)[0]
    if arcpy.Exists(layer2manipulate):
        arcpy.FeatureClassToFeatureClass_conversion(templateFC,wksp,outFile)
        arcpy.Append_management(layer2manipulate,yearlyFile,"NO_TEST")
        arcpy.Append_management(layer2manipulate,curGeocode,"NO_TEST")
        arcpy.AddMessage(r"Geocoded data has been archived (saved) for future reference.")
    else:
        arcpy.AddMessage(r"You must run the geocoding process first.")
else:
    arcpy.AddMessage(r"Geocoding data will not be saved and will be overwritten next time.")

Outcomes