<?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: Automate metadata to update summary section in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716745#M75350</link>
    <description>&lt;P&gt;Great, glad it worked for you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jul 2026 13:03:58 GMT</pubDate>
    <dc:creator>BobBooth1</dc:creator>
    <dc:date>2026-07-27T13:03:58Z</dc:date>
    <item>
      <title>Automate metadata to update summary section</title>
      <link>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716318#M75345</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am not a developer, I'm using ArcGIS Pro 3.5.7. I am using ModelBuilder to run a scheduled model every 1st day of the month to export feature classes from a SQL geodatabase to a file geodatabase. The next script I would like to run after hours (every 1st of the month) is to update the&amp;nbsp;summary section of the metadata of the feature classes in the file geodatabase with the current month and year and another 2 sentences added to the end of the current summary section.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have asked my friend Google AI to tell me how to do this. It has failed. So I come to you, much smarter people. Here is what Google AI told me and I tried to run this in a ArcGIS Pro notebook.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from datetime import datetime
import arcpy

dataset_path = r"E:\ArcGIS Pro\Name.gdb\Name"

try:
    # 1. Generate text snippet safely using built-in formatting
    append_text = datetime.now().strftime(", %B %Y. Please note that")
    
    # 2. Access the metadata object
    target_metadata = arcpy.metadata.Metadata(dataset_path)
    
    # 3. Safely read current summary using a rigid string conversion check
    raw_summary = target_metadata.summary
    
    # Check if raw_summary is a valid string, not a class type or None
    if isinstance(raw_summary, str) and not isinstance(raw_summary, type):
        current_summary = raw_summary
    else:
        current_summary = ""
        
    # 4. Append and write back
    target_metadata.summary = f"{current_summary}{append_text}"
    
    # 5. Save changes
    target_metadata.save()
    print(f"Successfully updated metadata summary.")

except Exception as e:
    print(f"Failed to update metadata: {e}")&lt;/LI-CODE&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;PRE&gt;Failed to update metadata: &amp;lt;class 'type'&amp;gt; returned a result with an exception set&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I have tried to find documentation on this and I searched the community for previous questions and answers but those are mostly very old so the software version is too old, and in some cases, they were using good old ArcMap. I did watch a few Esri videos about Metadata, very informative, but no mention of using python.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-blog/live-training-seminar-metadata-essentials-for-ai/ba-p/1698657" target="_blank"&gt;https://community.esri.com/t5/arcgis-pro-blog/live-training-seminar-metadata-essentials-for-ai/ba-p/1698657&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://mediaspace.esri.com/media/t/1_o8wuj2ba" target="_blank"&gt;https://mediaspace.esri.com/media/t/1_o8wuj2ba&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://doc.esri.com/en/arcgis-pro/latest/arcpy/metadata/what-is-the-metadata-module.html" target="_blank"&gt;https://doc.esri.com/en/arcgis-pro/latest/arcpy/metadata/what-is-the-metadata-module.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Is this possible? Please help, thank you!&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2026 20:31:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716318#M75345</guid>
      <dc:creator>AndreaB_</dc:creator>
      <dc:date>2026-07-23T20:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Automate metadata to update summary section</title>
      <link>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716330#M75346</link>
      <description>&lt;P&gt;This worked for me:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from arcpy import metadata as md
from datetime import datetime

# Define the path to your dataset
item_path = r"C:\Users\MyUserName\Documents\ArcGIS\Projects\MetadataTest\MetadataTest.gdb\OH_geol_poly"

append_text = datetime.now().strftime(", %B %Y. Please note that")
other_text = "Some arbitary other text."

# Access the metadata
item_md = md.Metadata(item_path)
oldSummary = item_md.summary
try:
    item_md.summary = oldSummary + "\r" + append_text + "\r" + other_text
    item_md.save()
except:
    print("Ope! Could not write to metadata. Maybe locked?")
item_md.summary    &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="metadata_update_code.png" style="width: 712px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/155836iC96513638A315A49/image-size/large?v=v2&amp;amp;px=999" role="button" title="metadata_update_code.png" alt="metadata_update_code.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2026 21:39:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716330#M75346</guid>
      <dc:creator>BobBooth1</dc:creator>
      <dc:date>2026-07-23T21:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Automate metadata to update summary section</title>
      <link>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716333#M75347</link>
      <description>&lt;P&gt;This tutorial shows how you can schedule a Python script to run at specific times.&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.arcgis.com/en/projects/schedule-automated-near-real-time-data-updates/" target="_blank" rel="noopener"&gt;https://learn.arcgis.com/en/projects/schedule-automated-near-real-time-data-updates/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2026 22:08:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716333#M75347</guid>
      <dc:creator>BobBooth1</dc:creator>
      <dc:date>2026-07-23T22:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: Automate metadata to update summary section</title>
      <link>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716367#M75348</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Metadata can be read-only. So you need to check it before step 4.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if not target_metadata.isReadOnly:
    # 4. Append and write back
    target_metadata.summary = f"{current_summary}{append_text}"
    
    # 5. Save changes
    target_metadata.save()
    print(f"Successfully updated metadata summary.")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2026 05:15:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716367#M75348</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2026-07-24T05:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Automate metadata to update summary section</title>
      <link>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716519#M75349</link>
      <description>&lt;P&gt;Thank you!! It works great. I really appreciate it.&lt;/P&gt;&lt;P&gt;I highly enjoyed the 'ope' until I could get it to run - I had some permissions errors.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2026 18:26:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716519#M75349</guid>
      <dc:creator>AndreaB_</dc:creator>
      <dc:date>2026-07-24T18:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: Automate metadata to update summary section</title>
      <link>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716745#M75350</link>
      <description>&lt;P&gt;Great, glad it worked for you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2026 13:03:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-metadata-to-update-summary-section/m-p/1716745#M75350</guid>
      <dc:creator>BobBooth1</dc:creator>
      <dc:date>2026-07-27T13:03:58Z</dc:date>
    </item>
  </channel>
</rss>

