<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ASCIIToRaster_conversion Error  010328 and 010267 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/asciitoraster-conversion-error-010328-and-010267/m-p/676989#M52398</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;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"&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the results. I should note that&amp;nbsp;the program is creating the directory successfully. Line 37 refers to the arcpy.ASCIIToRaster...command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chickpea_105_low&lt;BR /&gt;G:/GIS Data/FAO GAEZ/rasters/World/low_irrigation/chickpea_105_low&lt;BR /&gt;G:/GIS Data/FAO GAEZ/rasters/World/low_irrigation/chickpea_105_low/data&lt;BR /&gt;G:/GIS Data/FAO GAEZ/low irrigation/chickpea_105_low/data.asc&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Users\achanda\Dropbox\Research\India Canals\python\lowirrigationpixels.py", line 37, in &amp;lt;module&amp;gt;&lt;BR /&gt;arcpy.ASCIIToRaster_conversion(asciiname,outRaster)&lt;BR /&gt;File "C:\Program Files (x86)\ArcGIS\Desktop10.6\ArcPy\arcpy\conversion.py", line 2461, in ASCIIToRaster&lt;BR /&gt;raise e&lt;BR /&gt;ExecuteError: ERROR 010328: Syntax error at or near symbol SPACE.&lt;BR /&gt;ERROR 010267: Syntax error in parsing grid expression.&lt;BR /&gt;Failed to execute (ASCIIToRaster).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 16:46:20 GMT</pubDate>
    <dc:creator>AreendamChanda</dc:creator>
    <dc:date>2021-12-12T16:46:20Z</dc:date>
    <item>
      <title>ASCIIToRaster_conversion Error  010328 and 010267</title>
      <link>https://community.esri.com/t5/python-questions/asciitoraster-conversion-error-010328-and-010267/m-p/676989#M52398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;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"&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the results. I should note that&amp;nbsp;the program is creating the directory successfully. Line 37 refers to the arcpy.ASCIIToRaster...command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chickpea_105_low&lt;BR /&gt;G:/GIS Data/FAO GAEZ/rasters/World/low_irrigation/chickpea_105_low&lt;BR /&gt;G:/GIS Data/FAO GAEZ/rasters/World/low_irrigation/chickpea_105_low/data&lt;BR /&gt;G:/GIS Data/FAO GAEZ/low irrigation/chickpea_105_low/data.asc&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Users\achanda\Dropbox\Research\India Canals\python\lowirrigationpixels.py", line 37, in &amp;lt;module&amp;gt;&lt;BR /&gt;arcpy.ASCIIToRaster_conversion(asciiname,outRaster)&lt;BR /&gt;File "C:\Program Files (x86)\ArcGIS\Desktop10.6\ArcPy\arcpy\conversion.py", line 2461, in ASCIIToRaster&lt;BR /&gt;raise e&lt;BR /&gt;ExecuteError: ERROR 010328: Syntax error at or near symbol SPACE.&lt;BR /&gt;ERROR 010267: Syntax error in parsing grid expression.&lt;BR /&gt;Failed to execute (ASCIIToRaster).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:46:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/asciitoraster-conversion-error-010328-and-010267/m-p/676989#M52398</guid>
      <dc:creator>AreendamChanda</dc:creator>
      <dc:date>2021-12-12T16:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: ASCIIToRaster_conversion Error  010328 and 010267</title>
      <link>https://community.esri.com/t5/python-questions/asciitoraster-conversion-error-010328-and-010267/m-p/676990#M52399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you try saving to a directory that contains no spaces, just to rule that out?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2019 21:13:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/asciitoraster-conversion-error-010328-and-010267/m-p/676990#M52399</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2019-01-25T21:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: ASCIIToRaster_conversion Error  010328 and 010267</title>
      <link>https://community.esri.com/t5/python-questions/asciitoraster-conversion-error-010328-and-010267/m-p/676991#M52400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;line numbers and formatting&amp;nbsp;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;/blogs/dan_patterson/2016/08/14/script-formatting&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for future reference&lt;/P&gt;&lt;P&gt;And I would recommend saving to *.tif raster format, in a folder.&amp;nbsp; tifs behave better than the old esri grid format since they have fewer restrictions on how they are named&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2019 23:11:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/asciitoraster-conversion-error-010328-and-010267/m-p/676991#M52400</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-01-25T23:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: ASCIIToRaster_conversion Error  010328 and 010267</title>
      <link>https://community.esri.com/t5/python-questions/asciitoraster-conversion-error-010328-and-010267/m-p/676992#M52401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your replies. It was definitely the long directory name with spaces. I really need to address that.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dan, thanks for directing me to those instructions as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2019 23:50:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/asciitoraster-conversion-error-010328-and-010267/m-p/676992#M52401</guid>
      <dc:creator>AreendamChanda</dc:creator>
      <dc:date>2019-01-25T23:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: ASCIIToRaster_conversion Error  010328 and 010267</title>
      <link>https://community.esri.com/t5/python-questions/asciitoraster-conversion-error-010328-and-010267/m-p/676993#M52402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/people/curtvprice/blog/2016/05/07/how-to-name-things-in-arcgis?sr=search&amp;amp;searchId=8f9466e8-1406-40ed-96cb-45115fe01ee8&amp;amp;searchIndex=5"&gt;https://community.esri.com/people/curtvprice/blog/2016/05/07/how-to-name-things-in-arcgis?sr=search&amp;amp;searchId=8f9466e8-1406-40ed-96cb-45115fe01ee8&amp;amp;searchIndex=5&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2019 19:29:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/asciitoraster-conversion-error-010328-and-010267/m-p/676993#M52402</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2019-03-14T19:29:29Z</dc:date>
    </item>
  </channel>
</rss>

