&引用;“提出e执行错误”;循环时在Python ArcPy模块中
&引用;“提出e执行错误”;循环时在Python ArcPy模块中,python,loops,error-handling,arcpy,Python,Loops,Error Handling,Arcpy,Resample\u management功能是ArcPy模块的一部分,该模块只能与ArcGIS软件一起安装。 它的默认形式是: arcpy.Resample_management("D:\InputFile", "D:\OutputFile.tif", "1000 1000", "BILINEAR") 这样就行了。但是当我把它放在一个循环中时,我得到了一个错误 Input=glob.glob("D:\Freelancer\oDesk\Create-ArcPy-Scripts\TestFile
Resample\u management
功能是ArcPy模块的一部分,该模块只能与ArcGIS软件一起安装。
它的默认形式是:
arcpy.Resample_management("D:\InputFile", "D:\OutputFile.tif", "1000 1000", "BILINEAR")
这样就行了。但是当我把它放在一个循环中时,我得到了一个错误
Input=glob.glob("D:\Freelancer\oDesk\Create-ArcPy-Scripts\TestFiles\*tif")
#Glob makes an array with all the TIF files inside a folder.
for i in Input:
arcpy.Resample_management(i, "D:\OutputFolder\%s_1000.tif" % i, "1000 1000", "BILINEAR")
Runtime error Traceback (most recent call last): File "<string>", line 2, in <module> File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py", line 12407, in Resample raise e ExecuteError: ERROR 999999: Error executing function. Failed to execute (Resample).
Input=glob.glob(“D:\freeloper\oDesk\Create ArcPy Scripts\TestFiles\*tif”)
#Glob在一个文件夹中创建一个包含所有TIF文件的数组。
对于输入中的i:
arcpy.Resample_管理(i,“D:\OutputFolder\%s_1000.tif”%i,“1000 1000”,“双线性”)
运行时错误回溯(上次调用):文件“c:\program files(x86)\arcgis\desktop10.1\arcpy\arcpy\management.py”中的第2行文件“”,第12407行,在重采样raise ExecuteError:error 99999:执行函数时出错。无法执行(重新采样)。
如果我查找错误999999,它会说“这是一个没有ID的错误”。
我的循环是否有问题,或者这显然是ArcPy模块的问题?这有帮助吗
for i, filename in enumerate(sorted(list(Input))):
arcpy.Resample_management(filename, "D:\OutputFolder\%s_1000.tif" % i, "1000 1000", "BILINEAR")
我不能试一下,但我希望它会有帮助。这会有帮助吗
for i, filename in enumerate(sorted(list(Input))):
arcpy.Resample_management(filename, "D:\OutputFolder\%s_1000.tif" % i, "1000 1000", "BILINEAR")
我无法尝试,但我希望它能有所帮助。我无法尝试重采样管理过程本身,但当我尝试下面的“打印I”时,它会给我一个从0到5的列表。我无法尝试重采样管理过程本身,但当我尝试下面的“打印I”时,它会给我一个从0到5的列表。