This code that I've written runs fine up until Extract by Attributes, then hangs (continues running, with no output). What did I do wrong?
import arcpy
arcpy.CheckOutExtension ("Spatial")
from arcpy import env
from arcpy.sa import *
#Allows overwriting
arcpy.env.overwriteOutput = True
##Set workspace; necessary for arcpy scripts
##note that following commands only work for the defined workspace: i.e., the ExtractbyAttributes command automatically convert all rasters in the geodatabase specified
arcpy.env.workspace = r"S:\FIRE\year1992to2000"
####iteratively defines each subfolder as a workspace; for each raster in each subfolder, converts to specified geodatabase
workspaces = arcpy.ListWorkspaces()
for workspace in workspaces:
arcpy.env.workspace = workspace
for raster in arcpy.ListRasters():
arcpy.RasterToGeodatabase_conversion (raster, r"S:\FIRE\t92to00.gdb")
#resets workspace to geodatabase mentioned above
#the "r" before the pathname tells python that this is an absolute pathname. Hard to explain, but some combinations of slashes and characters are read as commands (for example, /g means the end of a line) by arcgis and will cause it to parse the pathname incorrectly. The "r" prevents this.
arcpy.env.workspace = r"S:\FIRE\t92to00.gdb"
#adds table for final append operation
#table created manually--you could create one within the program if you wanted, using the CreateTable and AddField commands
outtable = r"S:\FIRE\73to80.gdb\y92to00"
#for each raster in geodatabase, extract by attributes to include only pixels with the correct values, in this case, 6 and 2
#rename resulting rasters; "af" refers to conversions from forest and ag only
for raster in arcpy.ListRasters():
outpoint = raster + "af"
extract = arcpy.sa.ExtractByAttributes (raster, " VALUE = 6 OR VALUE = 8")
extract.save (outpoint)
#"for" loop calls only rasters with "af" in the name
#RastertoPoint_conversion converts rasters to point files to enable use of Mean Center
#rename resulting shapefiles; keep original file information
for raster in arcpy.ListRasters ("af", "*"):
outpoint= raster[:8] + "p"
arcpy.RastertoPoint_Conversion (raster, outpoint)
#"for" loop calls only point feature classes in the workspace
#MeanCenter_stats creates a new point shapefile with a single point, the mean center of the points extracted in the previous step
#rename the resulting shapefiles
for fc in arcpy.ListFeatureClasses ("p", "Point"):
outmean= fc[:8] + "m"
arcpy.MeanCenter_stats (fc, outmean)
uid = fc[1:8]
arcpy.AddField_management(outmean, "UID", "TEXT")
arcpy.CalculateField_management(outmean, "UID", '"'+uid+'"')
#"for" loop calls only point feature classes with the phrase "mean" in their filename
#Near_analysis adds new columns to the mean center point file
#"infeat" is a single shapefile containing the borders of public lands in California
for fc in arcpy.ListFeatureClasses ("m", "Point"):
infeat= "S:\FIRE\ben_data\NPSFSBLM"
arcpy.Near_analysis (fc, infeat)
arcpy.MakeTableView (fc, "tv")
arcpy.AppendManagement ("tv", outtable, "NO_TEST", "", "")