<?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 write GUID using Python in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/write-guid-using-python/m-p/118035#M4093</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a feature class with a GUID field. I would like to use Python to write a GUID (copied from a GlobalID) to this field. How do I do that? I have tried several possibilities, but all seem to fail. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kalle&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 May 2010 20:20:51 GMT</pubDate>
    <dc:creator>KalleKronholm</dc:creator>
    <dc:date>2010-05-12T20:20:51Z</dc:date>
    <item>
      <title>write GUID using Python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/write-guid-using-python/m-p/118035#M4093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a feature class with a GUID field. I would like to use Python to write a GUID (copied from a GlobalID) to this field. How do I do that? I have tried several possibilities, but all seem to fail. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kalle&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 May 2010 20:20:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/write-guid-using-python/m-p/118035#M4093</guid>
      <dc:creator>KalleKronholm</dc:creator>
      <dc:date>2010-05-12T20:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: write GUID using Python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/write-guid-using-python/m-p/118036#M4094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN style="font-family:Arial;"&gt;Hi Kalle, &lt;BR /&gt;&lt;BR /&gt;Try this:&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
fc = 'TEST.russellpythonguidtest'
rows = arcpy.UpdateCursor(fc)
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.PYTHONGUID = row.GlobalID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)
&lt;/PRE&gt;&lt;SPAN&gt;Here is an option if you want to have a GUID that is unique from the GlobalID.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import uuid
fc = 'TEST.russellpythonguidtest'
rows = arcpy.UpdateCursor(fc)
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.PYTHONGUID = '{' + str(uuid.uuid1()) + '}'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)
&lt;/PRE&gt;&lt;SPAN style="font-family:Arial;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family:Arial;"&gt;There is some more doc here on using UUIDs with Python. You can use uuid4() to get a more random assignment.&amp;nbsp; &lt;A href="http://docs.python.org/library/uuid.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://docs.python.org/library/uuid.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:55:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/write-guid-using-python/m-p/118036#M4094</guid>
      <dc:creator>RussellBrennan</dc:creator>
      <dc:date>2021-12-11T06:55:25Z</dc:date>
    </item>
  </channel>
</rss>

