Select to view content in your preferred language

Extract by Mask Not Saving to Correct Location

501
2
10-30-2013 06:00 PM
RachelAlbritton
Frequent Contributor
My script has been working fine and it's suddenly stopped. Its getting hung up on the Extract by Mask task, and its failing because its trying to save the output to a location other then what I've specified. Why would this be happening? I've even restarted my computer and I'm still getting the same problem.

import arcpy

#set workspaces
arcpy.env.workspace = "C:\\ArcGIS\\SurfCityData\\Data" #arcpy.GetParameterAsText(0) 
outputWorkspace = "C:\\ArcGIS\\SurfCityData\\Data\\OutputData" #arcpy.GetParameterAsText(1) 
arcpy.env.overwriteOutput = True

#Variables
ObsPts = "C:\\ArcGIS\\SurfCityData\\Data\\Projected_Data\\Test_Points.shp" #arcpy.GetParameterAsText(2)
footprint =  "C:\\ArcGIS\\SurfCityData\\Data\\Projected_Data\\Building_Footprints.shp" #arcpy.GetParameterAsText(3) 
Elevation = "C:\\ArcGIS\\SurfCityData\\Data\\Projected_Data\\new_2010 "#arcpy.GetParameterAsText(4)
BareElevation = "C:\\ArcGIS\\SurfCityData\\Data\\Projected_Data\\baregrnd" #arcpy.GetParameterAsText(5)

FOLDER = outputWorkspace+"/Intermediate_Files_1_"+Year

PointsFL = outName(ObsPts,"_Lyr")
footprintFL = outName(footprint,"_Lyr")
arcpy.MakeFeatureLayer_management(ObsPts, LAYER)
arcpy.MakeFeatureLayer_management(footprint,footprintFL)

try:
            
            FID = "FID=%s" % (points)

            #Get bare earth elevation of parcel
            arcpy.SelectLayerByAttribute_management(LAYER,"NEW_SELECTION",FID)
            arcpy.SelectLayerByLocation_management(footprintFL,"INTERSECT",LAYER)
            outExtractByMask = ExtractByMask(BareElevation,footprintFL)
            outExtractByMask.save(FOLDER+"/tempfp_"+str(FID)[4:])

except:
            print arcpy.GetMessages()



ERROR MESSAGE:

ERROR 000875: Output raster: C:\ArcGIS\SurfCityData\Data\OutputData/Intermediate_Files_1_2010\Extract_bare1's workspace is an invalid output workspace.
Tags (2)
0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Rachel,

Try changing the line:

outExtractByMask.save(FOLDER+"/tempfp_"+str(FID)[4:])


to:

outExtractByMask.save(FOLDER+"\\tempfp_"+str(FID)[4:])
0 Kudos
RachelAlbritton
Frequent Contributor
Thanks for the suggestion. The entire script just keeps crashing now - both inside Arcmap and if i try to run the stand alone script.

Something that just occured to me - I wrote the script in python 2.7, ArcMap 10.1 but I'm currently trying to execute it with python 2.6.5/ArcMap 10. Could this be causing it to crash? Could moving the script back and forth between version corrupt the file in any way?
0 Kudos