AnsweredAssumed Answered

ASCIIToRaster_conversion Error  010328 and 010267

Question asked by achanda@lsu.edu on Jan 25, 2019
Latest reply on Mar 14, 2019 by curtvprice

Here is a program that worked well six months ago doing the same thing but refuses to do so now and returns the error messages. Any advice would be appreciated.

import arcpy, os, glob, shutil, fnmatch
from arcpy import env
from arcpy.sa import *
import time
start_time = time.time()
arcpy.CheckOutExtension("Spatial")
env.overwriteOutput = True
# Set environment
arcpy.env.workspace = "G:/GIS Data/FAO GAEZ/low irrigation"
arcpy.env.scratchWorkspace="G:/GIS Data/scratch"

# Set local variables
# folder containing only input rasters and nothing else
inws = "G:/GIS Data/FAO GAEZ/low irrigation"
outws="G:/GIS Data/FAO GAEZ/rasters/World/low_irrigation"
rasters=[]

for root, dirs, files in os.walk(inws):
for subdir in dirs:
print subdir
directory=outws+"/"+subdir
print directory
outRaster=directory+"/"+"data"
print outRaster
asciiname=root+"/"+subdir+"/data.asc"
print asciiname
if not os.path.exists(directory):
os.makedirs(directory)
arcpy.ASCIIToRaster_conversion(asciiname,outRaster)
print "Done"

 

Here are the results. I should note that the program is creating the directory successfully. Line 37 refers to the arcpy.ASCIIToRaster...command.

 

chickpea_105_low
G:/GIS Data/FAO GAEZ/rasters/World/low_irrigation/chickpea_105_low
G:/GIS Data/FAO GAEZ/rasters/World/low_irrigation/chickpea_105_low/data
G:/GIS Data/FAO GAEZ/low irrigation/chickpea_105_low/data.asc

Traceback (most recent call last):
File "C:\Users\achanda\Dropbox\Research\India Canals\python\lowirrigationpixels.py", line 37, in <module>
arcpy.ASCIIToRaster_conversion(asciiname,outRaster)
File "C:\Program Files (x86)\ArcGIS\Desktop10.6\ArcPy\arcpy\conversion.py", line 2461, in ASCIIToRaster
raise e
ExecuteError: ERROR 010328: Syntax error at or near symbol SPACE.
ERROR 010267: Syntax error in parsing grid expression.
Failed to execute (ASCIIToRaster).

Outcomes