AnsweredAssumed Answered

Empty Feature class created?

Question asked by CCweedcontrol on Aug 20, 2015
Latest reply on Aug 21, 2015 by bixb0012

I have a script here and seems simple enough but for some reason after the script is done it creates an empty feature class. I don't get any errors..  Am i missing something?

 

 

 

# Import arcpy module
import arcpy
import os
from arcpy import env
from datetime import datetime as d
startTime = d.now()

arcpy.env.workspace = "C:\GIS\weeds\Weeds.gdb"
arcpy.env.overwriteOutput = "True"
arcpy.env.qualifiedFieldNames = False

CITY = "C:\GIS\weeds\Weeds.gdb\City_Limits"

Taxparcels = "C:\GIS\weeds\Weeds.gdb\Parcels"
ADMIN = "C:\GIS\weeds\Weeds.gdb\ADMIN"
temp = "C:\GIS\weeds\Weeds.gdb"

# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(Taxparcels, "In_memory\Par")

# Process: Analysis Erase
arcpy.Erase_analysis("In_memory\Par", CITY, "In_memory\Par_ERASE","")

arcpy.MakeFeatureLayer_management("In_memory\Par_ERASE", "In_memory\Par1")

# Process: Add Join
try:
    arcpy.AddJoin_management("In_memory\Par1", "ACCOUNT", ADMIN, "Acct", "KEEP_ALL")
except BaseException as e:
    pass
#arcpy.FeatureClassToFeatureClass_conversion("In_memory\Par1", temp, "TaxWeed1")#working
arcpy.MakeFeatureLayer_management("In_memory\Par1", "In_memory\Par2")

# Process: Select Layer By Attribute
arcpy.SelectLayerByAttribute_management("In_memory\Par2", "NEW_SELECTION", "\"TEXT\" = 'common area'")

# Process: Delete Features
if int(arcpy.GetCount_management("In_memory\Par2").getOutput(0)) > 0:
    arcpy.DeleteFeatures_management("In_memory\Par2")

    
# Process: Make Feature Layer (2)
TaxPar2 = "weedtax"
arcpy.MakeFeatureLayer_management("In_memory\Par2", TaxPar2)

arcpy.FeatureClassToFeatureClass_conversion(TaxPar2, temp, "TaxWeed")
arcpy.Delete_management("In_memory\Par")
arcpy.Delete_management("In_memory\Par1")
arcpy.Delete_management("In_memory\Par2")
arcpy.Delete_management("In_memory\Par_ERASE")
#arcpy.Delete_management("In_memory\ParCel")

try:
    print '(Elapsed time: ' + str(d.now() - startTime)[:-3] + ')'

except Exception, e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print "Line %i" % tb.tb_lineno
    print e.message

Outcomes