<?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 Problem with attachments in arcpy in Python Snippets Questions</title>
    <link>https://community.esri.com/t5/python-snippets-questions/problem-with-attachments-in-arcpy/m-p/795324#M212</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't really know how to word my question in only a few words for the head line... Let me try to explain my problem:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a script that attaches .png files to point features. The idea is to have those files matched to the point that have the same UID as the point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;AddAttachmentsToUid&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GenerateAttachmentMatchTable_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_location_for_points&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _location_for_attachments&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _matchtable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"UID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"*.png"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ABSOLUTE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddAttachments_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_location_for_points&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OBJECTID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _matchtable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"MatchID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Filename"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UIDs look e.g. like&amp;nbsp;KivuWatt_151113_9 - the last number is ranging in this case from 1 to 16.&amp;nbsp;&lt;/P&gt;&lt;P&gt;While it works perfect for all other files I tested so far, I have a problem with the files&amp;nbsp;&lt;SPAN&gt;KivuWatt_151113_1 and&amp;nbsp;KivuWatt_151113_10 up to ..._16 which are all attached to the point with the UID&amp;nbsp;KivuWatt_151113_1 (and then again to the correct point).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your information (in case it matters): The png files store also a specified range in the file name, e.g.&amp;nbsp;&lt;SPAN&gt;KivuWatt_151113_&lt;/SPAN&gt;&lt;SPAN&gt;1_0-400.png&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt;&amp;nbsp;It is somehow understandable since the tool compares the uid with the file names and as long as they start with the same characters it matches them. So I think the best would be to compare the uid from the feature class with uid+_+*.png in the files, but how can a specify this within the&amp;nbsp;GenerateAttachmentMatchTable_management tool?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 09:10:58 GMT</pubDate>
    <dc:creator>Nicole_Ueberschär</dc:creator>
    <dc:date>2021-12-12T09:10:58Z</dc:date>
    <item>
      <title>Problem with attachments in arcpy</title>
      <link>https://community.esri.com/t5/python-snippets-questions/problem-with-attachments-in-arcpy/m-p/795324#M212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't really know how to word my question in only a few words for the head line... Let me try to explain my problem:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a script that attaches .png files to point features. The idea is to have those files matched to the point that have the same UID as the point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;AddAttachmentsToUid&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GenerateAttachmentMatchTable_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_location_for_points&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _location_for_attachments&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _matchtable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"UID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"*.png"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ABSOLUTE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddAttachments_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_location_for_points&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OBJECTID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _matchtable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"MatchID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Filename"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UIDs look e.g. like&amp;nbsp;KivuWatt_151113_9 - the last number is ranging in this case from 1 to 16.&amp;nbsp;&lt;/P&gt;&lt;P&gt;While it works perfect for all other files I tested so far, I have a problem with the files&amp;nbsp;&lt;SPAN&gt;KivuWatt_151113_1 and&amp;nbsp;KivuWatt_151113_10 up to ..._16 which are all attached to the point with the UID&amp;nbsp;KivuWatt_151113_1 (and then again to the correct point).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your information (in case it matters): The png files store also a specified range in the file name, e.g.&amp;nbsp;&lt;SPAN&gt;KivuWatt_151113_&lt;/SPAN&gt;&lt;SPAN&gt;1_0-400.png&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt;&amp;nbsp;It is somehow understandable since the tool compares the uid with the file names and as long as they start with the same characters it matches them. So I think the best would be to compare the uid from the feature class with uid+_+*.png in the files, but how can a specify this within the&amp;nbsp;GenerateAttachmentMatchTable_management tool?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:10:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/problem-with-attachments-in-arcpy/m-p/795324#M212</guid>
      <dc:creator>Nicole_Ueberschär</dc:creator>
      <dc:date>2021-12-12T09:10:58Z</dc:date>
    </item>
  </channel>
</rss>

