AnsweredAssumed Answered

Error in ExtractByMaskScript,

Question asked by workshop1 on Jun 3, 2019
Latest reply on Jun 3, 2019 by Dan_Patterson

Hi all, 

I do use ArcGIS often and I also used buit-in Python but very long time ago when I had ArcGIS 9. This time I get back to it again with ArcGIS 10.5. 

I have exported a simple script from Module Builder of ArcGIS and I did modification on some paths. However, when I ran the script, errors appears. 

The error is:

 

Traceback (most recent call last):
File "E:\Post_Graduate_Affairs\Mohammed_Forest\2ndObjective\AreaforSentinel\PythonOutput\Extractpy.py", line 17, in <module>
arcpy.gp.ExtractByMask_sa(NDVItif, R29, Extract_tif9)
File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\geoprocessing\_base.py", line 510, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
ExecuteError: ERROR 999999: Error executing function.
Failed to execute (ExtractByMask).

 

The script is:

import sys, string, os, arcgisscripting, math , arcpy, arcgisscripting, string
from arcpy import env
from arcpy.sa import *
gp = arcgisscripting.create()
gp.OverWriteOutput = 1
gp.CheckOutExtension("spatial")
arcpy.CheckOutExtension("spatial")
gp.AddToolbox("C:/Program Files (x86)/ArcGIS/Desktop10.5/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx")


# Local variables:
NDVItif = "E:/test/NDVI.tif"
R29 = "E:/test/R29.shp"
Extract_tif9 = "E:/test/NDVIR29.tif"

# Process: Extract by Mask
arcpy.gp.ExtractByMask_sa(NDVItif, R29, Extract_tif9)
print gp.GetMessages()

 

 

Any help would be high;y appreciated.

Outcomes