AddJoin crash in ArcGIS 10

Discussion created by stush on Apr 12, 2011
In case this is happening to anyone else, I'd like to try and save you 2 days of hair-pulling.

I have multiple scripts that work fine in ArcGIS 9.2 and 9.3, but, surprise! they crash Arc10 hard.  AddJoin bombs when I join a table to a raster, and what stopped it from crashing was doing a BuildRasterAttributeTable on the raster before turning it into a layer to be used in AddJoin.  Here's the code snippet:

# sub_watersheds is a polygon shapefile
gp.ZonalStatisticsAsTable_sa(sub_watersheds, subwshed_id_field, adjusted_load, sws_adj_load_table, "DATA")
gp.FeatureToRaster_conversion(sub_watersheds, subwshed_id_field, wshed_ras, Cell_Size)
gp.BuildRasterAttributeTable_management(wshed_ras, "OVERWRITE")
gp.MakeRasterLayer_management(wshed_ras, "wsheds", "#", "#")
if (install_info["Version"] == "10.0"):
   zstat_id_field = subwshed_id_field
   zstat_id_field = "VALUE"
gp.AddJoin_management("wsheds", "VALUE", sws_adj_load_table, zstat_id_field)

~ Stacie