Tonyalmeida

Python error 00732

Discussion created by Tonyalmeida on Nov 13, 2012
Latest reply on Nov 14, 2012 by mzcoyle
I am trying to create a script that will provide a list of parcel within a certain distance. I am not sure if my expression is correct or not. The user would have to input an "ACCOUNT" and based on the input it would then select features within 600 ft and export those to a .dbf.

I am receiving the following error.

Traceback (most recent call last):
  File "C:\GIS\Python Scripts\MailingListings.py", line 61, in <module>
    arcpy.SelectLayerByLocation_management(tax_Layer, Overlap_Type, Output_Layer_Name, Search_Distance, "NEW_SELECTION")
  File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py", line 6585, in SelectLayerByLocation
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Selecting Features: Dataset 'R0392800000' does not exist or is not supported
Failed to execute (SelectLayerByLocation).


# Import arcpy module
import arcpy, string



# Allow processes to overwrite exisiting data
arcpy.env.overwriteOutput = True
try:
    arcpy.Delete_management("C:\Temp\Listing.dbf")
except:
    pass


# Script arguments
TAX = arcpy.GetParameterAsText(0)
if TAX == '#' or not TAX:
    TAX = "O:\**\NotificationLots1152012.shp" # provide a default value if unspecified

SELECT_BY = arcpy.GetParameterAsText(1)
if SELECT_BY == '#' or not SELECT_BY:
    SELECT_BY = "\"ACCOUNT\" ='R0392800000'" # provide a default value if unspecified

Search_Distance = arcpy.GetParameterAsText(2)
if Search_Distance == '#' or not Search_Distance:
    Search_Distance = "600 Feet" # provide a default value if unspecified

Listing_dbf = arcpy.GetParameterAsText(3)
if Listing_dbf == '#' or not Listing_dbf:
    Listing_dbf = "C:\Temp\Listing.dbf" # provide a default value if unspecified

# Local variables:
tax_Layer = "TAX_1"
tax_Layer__3_ = "tax_Layer"
TaxParcels = "***Taxparcels"
Output_Layer_Name = SELECT_BY
Overlap_Type = "WITHIN_A_DISTANCE"
tax2_Layer = "tax_Layer"

whereClause = "ACCOUNT = " + str(SELECT_BY)

# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(TAX, tax_Layer, "", "", "FID FID VISIBLE NONE;Shape Shape VISIBLE NONE;DXF_TEXT DXF_TEXT VISIBLE NONE;ACCOUNT ACCOUNT VISIBLE NONE;OwnerName OwnerName VISIBLE NONE;Address Address VISIBLE NONE;City City VISIBLE NONE;State State VISIBLE NONE;ZipCode ZipCode VISIBLE NONE")

# Process: Make Feature Layer (2)
arcpy.MakeFeatureLayer_management(TaxParcels, tax2_Layer, "", "", "OBJECTID_1 OBJECTID_1 VISIBLE NONE;DXF_LAYER DXF_LAYER VISIBLE NONE;DXF_TEXT DXF_TEXT VISIBLE NONE;ACCOUNT ACCOUNT VISIBLE NONE;PIN PIN VISIBLE NONE;Shape Shape VISIBLE NONE;MinRights MinRights VISIBLE NONE;ACRES ACRES VISIBLE NONE;GlobalID GlobalID VISIBLE NONE;Shape.area Shape.area VISIBLE NONE;Shape.len Shape.len VISIBLE NONE")

# Process: Select Layer By Attribute
arcpy.SelectLayerByAttribute_management(tax2_Layer, "NEW_SELECTION", whereClause)

# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(tax_Layer, Overlap_Type, Output_Layer_Name, Search_Distance, "NEW_SELECTION")

# Process: Table Select
arcpy.TableSelect_analysis(tax_Layer__3_, Listing_dbf, "")


Outcomes