I am fairly new to python scripting. I am attempting to do some batch conversions from ASCII to Raster in order to save myself some time. However I am continually getting issues with my script.
My current script is:
import arcpy from arcpy import env import os from arcpy.sa import * # set current workspace env.workpace = "G:/Arc_GIS/ANUCLIM_DATA/2020-2039/c-ECHAM5/R1/extract" outworkpace = "G:/Arc_GIS/ANUCLIM_DATA/2020-2039/c-ECHAM5/R1/Python_out" dataType = "INTEGER" #Check out the arcGIS spatial Anaylst extension line arcpy.CheckOutExtension("Spatial") #Get a list of asciis for file in arcpy.ListFiles("*.asc"): #Print raster list print file outputraster = file[1:36] + ".tif" #save TIF #outraster.save(output) arcpy.ASCIIToRaster_conversion(file,outputraster,dataType)
I am returning with the error
Traceback (most recent call last): File "G:/Arc_GIS/Coding/ASCIIToRaster_conversion", line 15, in <module> for file in arcpy.ListFiles("*.asc"): TypeError: 'NoneType' object is not iterable
Where am I going wrong?