<?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: Updating arcpy.management.SetMosaicDatasetProperties works within ArcGIS Pro but not in a Standalone script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/updating-arcpy-management/m-p/1525007#M71292</link>
    <description>&lt;P&gt;Yeah I guess I omitted this from the actual script above, but I use a variable to associate the path to the SDE to set the arcpy.env.workspace.&lt;BR /&gt;&lt;BR /&gt;Will give this a try though, thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 21 Aug 2024 11:44:23 GMT</pubDate>
    <dc:creator>Danfranco</dc:creator>
    <dc:date>2024-08-21T11:44:23Z</dc:date>
    <item>
      <title>Updating arcpy.management.SetMosaicDatasetProperties works within ArcGIS Pro but not in a Standalone script</title>
      <link>https://community.esri.com/t5/python-questions/updating-arcpy-management/m-p/1524996#M71289</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from pprint import pprint

# Path to mosaic dataset - This is an SDE connection
mosaic_dataset = r"\\UNC_path\mosaic_dataset_name"

# Set the maximum number of rasters per mosaic
max_rasters = 42

# Update the mosaic dataset properties
arcpy.management.SetMosaicDatasetProperties(
    in_mosaic_dataset=mosaic_dataset,
    max_num_per_mosaic=max_rasters
)
pprint(arcpy.GetAllMessages(), width=120)
print(f"Updated the maximum number of rasters per mosaic to {max_rasters} for {mosaic_dataset}.")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here above is a very simple script, that runs perfectly within the Python window of ArcGIS Pro (v3.3.1), and updates the mosaic properties as expected.&lt;/P&gt;&lt;P&gt;However, I run the exact same script, and it runs with no errors, but doesn't update the number from the default of 20 to 42.&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 11:47:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-arcpy-management/m-p/1524996#M71289</guid>
      <dc:creator>Danfranco</dc:creator>
      <dc:date>2024-08-21T11:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Updating arcpy.management.SetMosaicDatasetProperties works within ArcGIS Pro but not in a Standalone script</title>
      <link>https://community.esri.com/t5/python-questions/updating-arcpy-management/m-p/1524999#M71290</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/set-mosaic-dataset-properties.htm" target="_blank"&gt;Set Mosaic Dataset Properties (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The only difference in the code example that I see in the link is that they established arcpy.env.workspace rather than specify a file path, perhaps setting the workspace rather than your unc path is worth a try&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 11:10:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-arcpy-management/m-p/1524999#M71290</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-08-21T11:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: Updating arcpy.management.SetMosaicDatasetProperties works within ArcGIS Pro but not in a Standalone script</title>
      <link>https://community.esri.com/t5/python-questions/updating-arcpy-management/m-p/1525007#M71292</link>
      <description>&lt;P&gt;Yeah I guess I omitted this from the actual script above, but I use a variable to associate the path to the SDE to set the arcpy.env.workspace.&lt;BR /&gt;&lt;BR /&gt;Will give this a try though, thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 11:44:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-arcpy-management/m-p/1525007#M71292</guid>
      <dc:creator>Danfranco</dc:creator>
      <dc:date>2024-08-21T11:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: Updating arcpy.management.SetMosaicDatasetProperties works within ArcGIS Pro but not in a Standalone script</title>
      <link>https://community.esri.com/t5/python-questions/updating-arcpy-management/m-p/1525008#M71293</link>
      <description>&lt;P&gt;Tried, this again, no Error, just doesn't update&lt;/P&gt;&lt;P&gt;[[2, 0, 'Start Time: 21 August 2024 12:28:48'],&lt;BR /&gt;[3, 0, 'Succeeded at 21 August 2024 12:29:11 (Elapsed Time: 22.48 seconds)']]&lt;BR /&gt;&lt;BR /&gt;This is all the message output I actually get from using the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;pprint(arcpy.GetAllMessages(), width=120)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 11:46:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-arcpy-management/m-p/1525008#M71293</guid>
      <dc:creator>Danfranco</dc:creator>
      <dc:date>2024-08-21T11:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: Updating arcpy.management.SetMosaicDatasetProperties works within ArcGIS Pro but not in a Standalone script</title>
      <link>https://community.esri.com/t5/python-questions/updating-arcpy-management/m-p/1536762#M72803</link>
      <description>&lt;P&gt;I was able to replicate the issue, your code ran in the Python console but not in the IDE VSCode. After digging a little (i.e. reading the help file) I noted that the input is a Mosaic Layer object but you supply a full path string. So tweaking the code to this, it all worked outside arcpro.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from pprint import pprint

# Path to mosaic dataset - This is an SDE connection
mosaic_dataset = r"C:\Scratch\fGDB_Scratch.gdb\mosDTM"

# Set the maximum number of rasters per mosaic
max_rasters = 42

arcpy.MakeMosaicLayer_management(mosaic_dataset, "myMos")

# Update the mosaic dataset properties
arcpy.management.SetMosaicDatasetProperties(in_mosaic_dataset="myMos", max_num_per_mosaic=max_rasters)

pprint(arcpy.GetAllMessages(), width=120)
print(f"Updated the maximum number of rasters per mosaic to {max_rasters} for {mosaic_dataset}.")&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 10 Sep 2024 10:48:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-arcpy-management/m-p/1536762#M72803</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2024-09-10T10:48:20Z</dc:date>
    </item>
  </channel>
</rss>

