2

I'm having trouble with a python script. It is essentially a near duplicate of another script which is running fine-- it is using different files, but apart from that the tools used and the order in which the tools are used is basically the same.

When I go run my duplicate tool, it won't stop running. It doesn't have any logic in it which would cause it to go into an infinite loop. It is essentially just a string of tools and outputs. Does anyone know what it could be about this loop that is keeping it from successfully finishing?

I've tried including print statements, but it seems to freeze so the print statements won't print.

Here is the code (with path named edited):

import arcpy

arcpy.geoprocessing.env.overwriteOutput = True   
#Variables
asOldParcelsFC  = r"string"  
asBoundary = r"string"
scParcelsInAS = r"string" 
newNotInOld_preclip = r"string" 
newNotInOld = r"string"

arcpy.MakeFeatureLayer_management(asOldParcelsFC, "asOldParcels_layer")
arcpy.MakeFeatureLayer_management(asBoundary, "AltamonteBoundary")
arcpy.MakeFeatureLayer_management(scParcelsInAS, "scParcels")

arcpy.AddJoin_management("scParcels", "PARCEL", "asOldParcels_layer", "PARCEL", "KEEP_ALL")
arcpy.SelectLayerByAttribute_management("scParcels", "NEW_SELECTION", "asOldParcels.PARCEL IS NOT NULL")
arcpy.SelectLayerByAttribute_management("scParcels", "SWITCH_SELECTION")
arcpy.CopyFeatures_management("scParcels", newNotInOld_preclip)
arcpy.Clip_analysis(newNotInOld_preclip, "AltamonteBoundary", newNotInOld)

arcpy.Delete_management(newNotInOld_preclip)
arcpy.Delete_management("AltamonteBoundary")
arcpy.Delete_management("asOldParcels_layer")
arcpy.Delete_management("scParcels")
8
  • 1
    For the sake of completeness, can you please post your code?
    – Radar
    Mar 19, 2015 at 16:51
  • Copy of script added.
    – Olivia
    Mar 19, 2015 at 16:54
  • 1
    How many features are in your scParcels featureclass? Also, what does your geoprocessing results window look like while this script is running - i.e. what geoprocessing tool is it hanging on?
    – Radar
    Mar 19, 2015 at 17:04
  • 48,147 parcels in scParcels, and it seems to be getting hung up on the first select by attribute.
    – Olivia
    Mar 19, 2015 at 17:13
  • 1
    When working with large tables and performing joins I would recommend creating an attribute index for both tables, help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//…, this should help the overall process speed wise.
    – artwork21
    Mar 19, 2015 at 17:32

1 Answer 1

4

When working with large tables and performing joins I would recommend creating an attribute index for both tables, Add Attribute Index, this should help the overall process speed wise.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.