<?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: Arcpy script results in RuntimeError: ERROR 999998: Unexpected Error in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53202#M288</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply! The problem has been solved by moving all the .save functions to the end of the script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still need arcpy.sa import * for&amp;nbsp;NbrRectangle for some reason.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Apr 2020 18:55:17 GMT</pubDate>
    <dc:creator>KonanPruiksma</dc:creator>
    <dc:date>2020-04-14T18:55:17Z</dc:date>
    <item>
      <title>Arcpy script results in RuntimeError: ERROR 999998: Unexpected Error</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53198#M284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made this pretty simple tool with the code below and all through last night it ran error free on every run. Now since this morning I am getting a RuntimeError: 999998: Unexpected Error. The error occurs on line 15:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;outMinus.save(r'D:\Documents\LocalReliefModel\TestRaster\difmodel.tif')&lt;/PRE&gt;&lt;P&gt;I have no idea why it isn't working all of the sudden. I can see it writing the raster file in the given location, but it gets deleted immediately and than the RuntimeError happens. I can't really find any solution and have tried different paths, names, setting it as a variable, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know what to do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy
from arcpy.sa import *

arcpy.env.overwriteOutput = True
arcpy.env.workspace = r'D:\Documents\LocalReliefModel'

DEM_org = r'D:\Documents\LocalReliefModel\TestRaster\GH_Toterfout.tif'

# Low pass filter -&amp;gt; Smoothed DEM (focal statistics)
outFocalStat = arcpy.sa.FocalStatistics(DEM_org, NbrRectangle(50, 50, "CELL"), 'MEAN')
outFocalStat.save(r'D:\Documents\LocalReliefModel\TestRaster\LPF.tif')

# Subtract smoothed DEM from the original DEM -&amp;gt; Difference model (Minus function)
outMinus = arcpy.sa.Minus(outFocalStat, DEM_org)
outMinus.save(r'D:\Documents\LocalReliefModel\TestRaster\difmodel.tif')

# Calculate the zero meters contours for the Difference model -&amp;gt;
# set of the break lines between the positive and negative features (convex and concave features; Contour function)
outCont_save = r'D:\Documents\LocalReliefModel\TestRaster\ZeroCont.tif'
outCont = arcpy.sa.Contour(outMinus, outCont_save, 100)

# Extract the real elevation of the cells from the original DEM, which intersects with the break lines -&amp;gt;
# simplified elevation raster (Extract by Mask function)
outMask = arcpy.sa.ExtractByMask(DEM_org, outCont)
outMask.save(r'D:\Documents\LocalReliefModel\TestRaster\ElExtract.tif')

# Convert the simplified elevation raster to the point features (only nonzero cells) -&amp;gt;
# elevation points (Raster to Point function)
outRastToPoint_save = r'D:\Documents\LocalReliefModel\TestRaster\RastToPoint'
outRastToPoint = arcpy.RasterToPoint_conversion(outMask, outRastToPoint_save)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:02:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53198#M284</guid>
      <dc:creator>KonanPruiksma</dc:creator>
      <dc:date>2021-12-10T22:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy script results in RuntimeError: ERROR 999998: Unexpected Error</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53199#M285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you said you tried different paths, but did you attempt changing the names?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2020 15:09:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53199#M285</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-04-14T15:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy script results in RuntimeError: ERROR 999998: Unexpected Error</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53200#M286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe because your outFocalStat is a raster object rather than a path.&lt;/P&gt;&lt;P&gt;also you a using arcpy.sa explicitly so theres no need for from arcpy.sa import *&lt;/P&gt;&lt;P&gt;one last guess might be not having&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.CheckOutExtension("Spatial")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2020 16:10:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53200#M286</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-04-14T16:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy script results in RuntimeError: ERROR 999998: Unexpected Error</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53201#M287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The issue is resolved now. The problem was with writing in-memory and not on drive. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2020 18:53:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53201#M287</guid>
      <dc:creator>KonanPruiksma</dc:creator>
      <dc:date>2020-04-14T18:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy script results in RuntimeError: ERROR 999998: Unexpected Error</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53202#M288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply! The problem has been solved by moving all the .save functions to the end of the script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still need arcpy.sa import * for&amp;nbsp;NbrRectangle for some reason.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2020 18:55:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53202#M288</guid>
      <dc:creator>KonanPruiksma</dc:creator>
      <dc:date>2020-04-14T18:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy script results in RuntimeError: ERROR 999998: Unexpected Error</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53203#M289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;because it is in the Spatial Analyst &lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/spatial-analyst/nbrrectangle-class.htm"&gt;module&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2020 20:46:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-results-in-runtimeerror-error-999998/m-p/53203#M289</guid>
      <dc:creator>SteveLynch</dc:creator>
      <dc:date>2020-04-14T20:46:39Z</dc:date>
    </item>
  </channel>
</rss>

