<?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 ArcPy SaveToLayerFile Fails – ArcGIS Pro 3.5.2 / Python 3.11.11 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-savetolayerfile-fails-arcgis-pro-3-5-2/m-p/1642968#M74615</link>
    <description>&lt;P&gt;I'm running a Python script on a local server that functions as a web service. The script receives a text file containing a list of parcel identifiers and uses&amp;nbsp;ArcPy&amp;nbsp;(Python 3.11.11) within&amp;nbsp;ArcGIS Pro 3.5.2&amp;nbsp;to generate geospatial images for each parcel.&lt;/P&gt;&lt;P&gt;The images are derived from raster datasets (Raster Dataset and Mosaic Dataset) stored in a geospatial database. The workflow includes:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Reading parcel IDs from a text file.&lt;/LI&gt;&lt;LI&gt;Filtering parcel and image datasets based on each ID.&lt;/LI&gt;&lt;LI&gt;Converting filtered data into layers.&lt;/LI&gt;&lt;LI&gt;Saving layers as&amp;nbsp;.lyrx&amp;nbsp;files using&amp;nbsp;arcpy.SaveToLayerFile.&lt;/LI&gt;&lt;LI&gt;Adding layers to an ArcGIS Pro project.&lt;/LI&gt;&lt;LI&gt;Exporting images as&amp;nbsp;.jpg.&lt;/LI&gt;&lt;LI&gt;Compressing the images into a&amp;nbsp;.zip&amp;nbsp;file.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Issue:&lt;/P&gt;&lt;P&gt;The script consistently fails during the&amp;nbsp;SaveToLayerFile&amp;nbsp;step after generating approximately 47 images. The error message is:&lt;/P&gt;&lt;P&gt;ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (&lt;A href="http://esriurl.com/support" target="_blank"&gt;http://esriurl.com/support&lt;/A&gt;) to Report a Bug and refer to the error help for potential solutions or workarounds.&lt;/P&gt;&lt;P&gt;Failed to execute (SaveToLayerFile).&lt;/P&gt;&lt;P&gt;This generic error doesn’t provide much insight. I’ve tried:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Running the script in batches (500, 100, 50, 25).&lt;/LI&gt;&lt;LI&gt;Adding timeouts between iterations.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The maximum output achieved is ~47 images (24 parcels × 3 image datasets), which suggests a possible issue with resource accumulation, memory handling, or internal ArcPy limitations.&lt;/P&gt;&lt;P&gt;Environment Details:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;ArcGIS Pro:&amp;nbsp;3.5.2&lt;/LI&gt;&lt;LI&gt;Python:&amp;nbsp;3.11.11 (ArcPy)&lt;/LI&gt;&lt;LI&gt;Execution Environment:&amp;nbsp;Local server (not virtualized or containerized)&lt;/LI&gt;&lt;LI&gt;Memory Usage:&amp;nbsp;~25% during execution&lt;/LI&gt;&lt;LI&gt;Dataset Access:&amp;nbsp;No restrictions from the script, but no admin access to inspect internal dataset configurations&lt;/LI&gt;&lt;LI&gt;Data Behavior:&amp;nbsp;No specific parcel or dataset pattern identified that triggers the error&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Looking for:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Has anyone encountered similar behavior with&amp;nbsp;SaveToLayerFile?&lt;/LI&gt;&lt;LI&gt;Are there known limitations or memory issues with ArcPy in this context?&lt;/LI&gt;&lt;LI&gt;Any suggestions for debugging or optimizing this workflow?&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Mon, 18 Aug 2025 17:55:38 GMT</pubDate>
    <dc:creator>JohnHernandez</dc:creator>
    <dc:date>2025-08-18T17:55:38Z</dc:date>
    <item>
      <title>ArcPy SaveToLayerFile Fails – ArcGIS Pro 3.5.2 / Python 3.11.11</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-savetolayerfile-fails-arcgis-pro-3-5-2/m-p/1642968#M74615</link>
      <description>&lt;P&gt;I'm running a Python script on a local server that functions as a web service. The script receives a text file containing a list of parcel identifiers and uses&amp;nbsp;ArcPy&amp;nbsp;(Python 3.11.11) within&amp;nbsp;ArcGIS Pro 3.5.2&amp;nbsp;to generate geospatial images for each parcel.&lt;/P&gt;&lt;P&gt;The images are derived from raster datasets (Raster Dataset and Mosaic Dataset) stored in a geospatial database. The workflow includes:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Reading parcel IDs from a text file.&lt;/LI&gt;&lt;LI&gt;Filtering parcel and image datasets based on each ID.&lt;/LI&gt;&lt;LI&gt;Converting filtered data into layers.&lt;/LI&gt;&lt;LI&gt;Saving layers as&amp;nbsp;.lyrx&amp;nbsp;files using&amp;nbsp;arcpy.SaveToLayerFile.&lt;/LI&gt;&lt;LI&gt;Adding layers to an ArcGIS Pro project.&lt;/LI&gt;&lt;LI&gt;Exporting images as&amp;nbsp;.jpg.&lt;/LI&gt;&lt;LI&gt;Compressing the images into a&amp;nbsp;.zip&amp;nbsp;file.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Issue:&lt;/P&gt;&lt;P&gt;The script consistently fails during the&amp;nbsp;SaveToLayerFile&amp;nbsp;step after generating approximately 47 images. The error message is:&lt;/P&gt;&lt;P&gt;ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (&lt;A href="http://esriurl.com/support" target="_blank"&gt;http://esriurl.com/support&lt;/A&gt;) to Report a Bug and refer to the error help for potential solutions or workarounds.&lt;/P&gt;&lt;P&gt;Failed to execute (SaveToLayerFile).&lt;/P&gt;&lt;P&gt;This generic error doesn’t provide much insight. I’ve tried:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Running the script in batches (500, 100, 50, 25).&lt;/LI&gt;&lt;LI&gt;Adding timeouts between iterations.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The maximum output achieved is ~47 images (24 parcels × 3 image datasets), which suggests a possible issue with resource accumulation, memory handling, or internal ArcPy limitations.&lt;/P&gt;&lt;P&gt;Environment Details:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;ArcGIS Pro:&amp;nbsp;3.5.2&lt;/LI&gt;&lt;LI&gt;Python:&amp;nbsp;3.11.11 (ArcPy)&lt;/LI&gt;&lt;LI&gt;Execution Environment:&amp;nbsp;Local server (not virtualized or containerized)&lt;/LI&gt;&lt;LI&gt;Memory Usage:&amp;nbsp;~25% during execution&lt;/LI&gt;&lt;LI&gt;Dataset Access:&amp;nbsp;No restrictions from the script, but no admin access to inspect internal dataset configurations&lt;/LI&gt;&lt;LI&gt;Data Behavior:&amp;nbsp;No specific parcel or dataset pattern identified that triggers the error&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Looking for:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Has anyone encountered similar behavior with&amp;nbsp;SaveToLayerFile?&lt;/LI&gt;&lt;LI&gt;Are there known limitations or memory issues with ArcPy in this context?&lt;/LI&gt;&lt;LI&gt;Any suggestions for debugging or optimizing this workflow?&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 18 Aug 2025 17:55:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-savetolayerfile-fails-arcgis-pro-3-5-2/m-p/1642968#M74615</guid>
      <dc:creator>JohnHernandez</dc:creator>
      <dc:date>2025-08-18T17:55:38Z</dc:date>
    </item>
  </channel>
</rss>

