<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Empty Feature class created? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/empty-feature-class-created/m-p/202732#M15596</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My guess, line #39 is deleting all of the features, so line #46 is copying an empty feature class to make a new, empty feature class.&amp;nbsp; When using the Select Layer By Attribute tool, be careful because all records are returned if no records meet the criteria.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Aug 2015 21:12:44 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2015-08-20T21:12:44Z</dc:date>
    <item>
      <title>Empty Feature class created?</title>
      <link>https://community.esri.com/t5/python-questions/empty-feature-class-created/m-p/202731#M15595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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..&amp;nbsp; Am i missing something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# 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:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddJoin_management("In_memory\Par1", "ACCOUNT", ADMIN, "Acct", "KEEP_ALL")
except BaseException as e:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 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)) &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management("In_memory\Par2")

&amp;nbsp;&amp;nbsp;&amp;nbsp; 
# 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:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print '(Elapsed time: ' + str(d.now() - startTime)[:-3] + ')'

except Exception, e:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # If an error occurred, print line number and error message
&amp;nbsp;&amp;nbsp;&amp;nbsp; import traceback, sys
&amp;nbsp;&amp;nbsp;&amp;nbsp; tb = sys.exc_info()[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Line %i" % tb.tb_lineno
&amp;nbsp;&amp;nbsp;&amp;nbsp; print e.message&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:04:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/empty-feature-class-created/m-p/202731#M15595</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-11T10:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Empty Feature class created?</title>
      <link>https://community.esri.com/t5/python-questions/empty-feature-class-created/m-p/202732#M15596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My guess, line #39 is deleting all of the features, so line #46 is copying an empty feature class to make a new, empty feature class.&amp;nbsp; When using the Select Layer By Attribute tool, be careful because all records are returned if no records meet the criteria.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Aug 2015 21:12:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/empty-feature-class-created/m-p/202732#M15596</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-08-20T21:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Empty Feature class created?</title>
      <link>https://community.esri.com/t5/python-questions/empty-feature-class-created/m-p/202733#M15597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok, so if no records are found in line 35, then at 39 it's selecting all records because nothing was found. So how can i by pass line 35 in case nothing is found?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Aug 2015 21:32:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/empty-feature-class-created/m-p/202733#M15597</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2015-08-20T21:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Empty Feature class created?</title>
      <link>https://community.esri.com/t5/python-questions/empty-feature-class-created/m-p/202734#M15598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Although a bit kludgy, you can run a Get Count before the selection and store that number.&amp;nbsp; Then, after the selection, you can compare the new Get Count with the old one.&amp;nbsp; If they are the same, nothing was selected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Aug 2015 18:35:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/empty-feature-class-created/m-p/202734#M15598</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-08-21T18:35:48Z</dc:date>
    </item>
  </channel>
</rss>

