<?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 Re: Python restarts when spatial analyst tools are used--help!! in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/python-restarts-when-spatial-analyst-tools-are/m-p/668839#M9737</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks for the reply! It looks like I am/have been running 32 bit python (Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32). I ran the script a few times trying to catch the error message that flashes for half a second before the command window closes and it says something like "FATAL ERROR (INDEF) \n directory full" I don't know what directory the message is referring to, but i'm not limited in disk space...any ideas?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A clue! That's a low level error from the raster engine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you set your geoprocessing scratch workspace? My guess is the one you have set (or the one you are defaulting to) is either full -- or you cannot write grids to it for another reason. (For example, it has a corrupted "info" folder, you don't have system write access, or it's a corrupted geodatabase.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I bet your problem is the current folder is being used as the scratch workspace, which will not work if you are starting your Python script from a folder to which you cannot write. In ArcMap, things are working because you have set the environment workspace there at the application level (geoprocessing &amp;gt; environments). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suggest setting the scratch and current workspace to the same location (best practice for raster processing!) and seeing if that helps you out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using the current workspace settings can save you a lot of complex path construction, everything is assumed to read and write from the current workspace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os
outRaster = r"C:\my_writeable_folder\outgrid"
arcpy.env.workspace = arcpy.env.scratchWorkspace = os.path.dirname(outRaster)
arcpy.sa.ZonalStatisticsAsTable(�?�)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 04:16:14 GMT</pubDate>
    <dc:creator>curtvprice</dc:creator>
    <dc:date>2021-12-12T04:16:14Z</dc:date>
    <item>
      <title>Python restarts when spatial analyst tools are used--help!!</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/python-restarts-when-spatial-analyst-tools-are/m-p/668836#M9734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm running geoprocessing scripts in IDLE and everything runs exactly as expected until it comes to a function that requires the spatial analyst module. the cost path or zonal statistics tools cause Python to restart immediately (and the Command window to close), without reporting an error. I've ran my script successfully before, but I very recently started to encounter this (bug?) in implementing the script. I've tried to repair ArcGIS 10.2, reinstall it, uninstall it and reinstall 10.1. I've also tried downloading a new version of Python 2.7.6 and added the libraries to get arcpy to import. Again, the script runs until it hits a spatial analyst tool. I've also tried arcpy.sa.ZonalStatisticsAsTable() command in addition to adding "from arcpy.sa import * ." The former worked a couple of times in the Python command window and then it suddenly stopped working. However, running the exact same spatial analyst tools with the exact same inputs in ArcMap works perfectly well. Does anyone have any suggestions for what could be wrong? a bug?&amp;nbsp; I've written my entire model to run in python and now it doesn't work anymore. HELP!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Dec 2013 03:00:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/python-restarts-when-spatial-analyst-tools-are/m-p/668836#M9734</guid>
      <dc:creator>GraceWu</dc:creator>
      <dc:date>2013-12-20T03:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: Python restarts when spatial analyst tools are used--help!!</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/python-restarts-when-spatial-analyst-tools-are/m-p/668837#M9735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you installed 64-bit background geoprocessing? If you have, you may be running into some of the&lt;/SPAN&gt;&lt;A href="http://blogs.esri.com/esri/supportcenter/2013/07/29/64-bit-vs-32-bit-python-explained/" rel="nofollow noopener noreferrer" target="_blank"&gt; limitations of 64 bit arcpy. &lt;/A&gt;&lt;SPAN&gt; (If you run models in "edit" mode, all processes run in the ArcMap foreground, which is always 32-bit arcpy.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have installed background GP, the last Python installed is 64-bit, so that's the one that comes up when you start up IDLE:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 &lt;STRONG style="color: &amp;quot;#FF0000&amp;quot;;"&gt;64 bit&lt;/STRONG&gt; (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
&amp;gt;&amp;gt;&amp;gt; &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The fix is to start 32-bit IDLE by making a copy of the shortcut and modifying its start up from&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;C:\Python27\ArcGISx6410.2\pythonw.exe "C:\Python27\ArcGISx6410.2\Lib\idlelib\idle.pyw"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;to&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;C:\Python27\ArcGIS10.2\pythonw.exe "C:\Python27\ArcGIS10.2\Lib\idlelib\idle.pyw"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:16:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/python-restarts-when-spatial-analyst-tools-are/m-p/668837#M9735</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-12T04:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Python restarts when spatial analyst tools are used--help!!</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/python-restarts-when-spatial-analyst-tools-are/m-p/668838#M9736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply! It looks like I am/have been running 32 bit python (Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32). I ran the script a few times trying to catch the error message that flashes for half a second before the command window closes and it says something like "FATAL ERROR (INDEF) \n directory full" I don't know what directory the message is referring to, but i'm not limited in disk space...any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also tried changing the following script, which, unmodified, runs perfectly fine in ArcMap:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.sa.ZonalStatisticsAsTable(inFeatureRaster, zoneField_RQ, inValueRaster_RQ, workspace + inFeatureProjects + "_ZonalStatsTable_RQ", "NODATA", "MEAN")&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;to a non-existent zone field, and it threw an error as expected:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000864: Zone field: The input is not within the defined domain.
ERROR 000889: Invalid field type.
Failed to execute (ZonalStatisticsAsTable).&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;so it looks like python is calling on the right SA functions. Now i'm just seriously confused.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:16:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/python-restarts-when-spatial-analyst-tools-are/m-p/668838#M9736</guid>
      <dc:creator>GraceWu</dc:creator>
      <dc:date>2021-12-12T04:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: Python restarts when spatial analyst tools are used--help!!</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/python-restarts-when-spatial-analyst-tools-are/m-p/668839#M9737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks for the reply! It looks like I am/have been running 32 bit python (Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32). I ran the script a few times trying to catch the error message that flashes for half a second before the command window closes and it says something like "FATAL ERROR (INDEF) \n directory full" I don't know what directory the message is referring to, but i'm not limited in disk space...any ideas?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A clue! That's a low level error from the raster engine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you set your geoprocessing scratch workspace? My guess is the one you have set (or the one you are defaulting to) is either full -- or you cannot write grids to it for another reason. (For example, it has a corrupted "info" folder, you don't have system write access, or it's a corrupted geodatabase.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I bet your problem is the current folder is being used as the scratch workspace, which will not work if you are starting your Python script from a folder to which you cannot write. In ArcMap, things are working because you have set the environment workspace there at the application level (geoprocessing &amp;gt; environments). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suggest setting the scratch and current workspace to the same location (best practice for raster processing!) and seeing if that helps you out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using the current workspace settings can save you a lot of complex path construction, everything is assumed to read and write from the current workspace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os
outRaster = r"C:\my_writeable_folder\outgrid"
arcpy.env.workspace = arcpy.env.scratchWorkspace = os.path.dirname(outRaster)
arcpy.sa.ZonalStatisticsAsTable(�?�)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:16:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/python-restarts-when-spatial-analyst-tools-are/m-p/668839#M9737</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-12T04:16:14Z</dc:date>
    </item>
  </channel>
</rss>

