<?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 Copy attributes from layer to table except OID and Geometry in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/copy-attributes-from-layer-to-table-except-oid-and/m-p/557479#M43566</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to copy attributes from a layer to a table but the Geometry fields are giving me problems. I need help ignoring the OID and Geometry fields and i though line 11 would do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The feature class fields&lt;/P&gt;&lt;P&gt;Shape.STArea() &amp;amp; Shape&amp;gt;STLength()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table fields&lt;/P&gt;&lt;P&gt;Shape_STarea_ &amp;amp; Shape_STLength&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following but get error.&lt;/P&gt;&lt;P&gt;line 17, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iCur.insertRow(row)&lt;BR /&gt;RuntimeError: Cannot find field 'Shape.STArea()'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy.env.workspace = r"C:Temp\Test.gdb"
database = r"C:Temp\Test.gdb"
fc1 = "TestLayer1
fc2 = "Table1"

dsc = arcpy.Describe(fc1)
fields = dsc.fields

# List all field names except the OID field and geometry fields
#
fieldnames = [fields.name for fields in fields if fields.name != dsc.OIDFieldName and fields.type != 'Geometry']
# Create cursors and insert new rows

with arcpy.da.SearchCursor(fc1,fieldnames) as sCur:
    with arcpy.da.InsertCursor(fc2,fieldnames) as iCur:
        for row in sCur:
            iCur.insertRow(row)
del sCur&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;/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;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;/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;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 00:04:05 GMT</pubDate>
    <dc:creator>CCWeedcontrol</dc:creator>
    <dc:date>2021-12-12T00:04:05Z</dc:date>
    <item>
      <title>Copy attributes from layer to table except OID and Geometry</title>
      <link>https://community.esri.com/t5/python-questions/copy-attributes-from-layer-to-table-except-oid-and/m-p/557479#M43566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to copy attributes from a layer to a table but the Geometry fields are giving me problems. I need help ignoring the OID and Geometry fields and i though line 11 would do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The feature class fields&lt;/P&gt;&lt;P&gt;Shape.STArea() &amp;amp; Shape&amp;gt;STLength()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table fields&lt;/P&gt;&lt;P&gt;Shape_STarea_ &amp;amp; Shape_STLength&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following but get error.&lt;/P&gt;&lt;P&gt;line 17, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iCur.insertRow(row)&lt;BR /&gt;RuntimeError: Cannot find field 'Shape.STArea()'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy.env.workspace = r"C:Temp\Test.gdb"
database = r"C:Temp\Test.gdb"
fc1 = "TestLayer1
fc2 = "Table1"

dsc = arcpy.Describe(fc1)
fields = dsc.fields

# List all field names except the OID field and geometry fields
#
fieldnames = [fields.name for fields in fields if fields.name != dsc.OIDFieldName and fields.type != 'Geometry']
# Create cursors and insert new rows

with arcpy.da.SearchCursor(fc1,fieldnames) as sCur:
    with arcpy.da.InsertCursor(fc2,fieldnames) as iCur:
        for row in sCur:
            iCur.insertRow(row)
del sCur&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;/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;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;/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;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:04:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attributes-from-layer-to-table-except-oid-and/m-p/557479#M43566</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-12T00:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attributes from layer to table except OID and Geometry</title>
      <link>https://community.esri.com/t5/python-questions/copy-attributes-from-layer-to-table-except-oid-and/m-p/557480#M43567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use the new data access Describe instead of the old. &amp;nbsp;access is via a dictionary key value&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;desc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Describe&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
flds &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFields&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;fld&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fld &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; flds &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; fld&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; desc&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'OIDFieldName'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;and&lt;/SPAN&gt; fld&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;type &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Geometry'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Parts'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;'Points'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;'Curves'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;'Shape_Length'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;'Shape_Area'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;'A0'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;'A1'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;'Value_0'&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;/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;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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:04:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attributes-from-layer-to-table-except-oid-and/m-p/557480#M43567</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T00:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attributes from layer to table except OID and Geometry</title>
      <link>https://community.esri.com/t5/python-questions/copy-attributes-from-layer-to-table-except-oid-and/m-p/557481#M43568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried &lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/functions/gdb-featureclass-properties.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/functions/gdb-featureclass-properties.htm"&gt;GDB FeatureClass properties—ArcPy Functions | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;DIV class="" style="color: #4c4c4c; font-family: 'Avenir Next W01', 'Avenir Next W00', 'Avenir Next', Avenir, 'Helvetica Neue', sans-serif; font-size: 17px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;H2 style="font-weight: 300; font-style: normal; margin: 0px 0px 1.55rem; font-size: 1.9994rem; line-height: 2.325rem; padding-top: 0px;"&gt;Properties&lt;/H2&gt;&lt;TABLE style="margin-bottom: 1.55rem; width: 761.333px; background-color: #ffffff; border-collapse: collapse; border-spacing: 0px; border: 1px solid #cccccc; text-align: left; overflow: auto; font-size: 0.875rem; line-height: 1.55rem;"&gt;&lt;THEAD style="background-color: #efefef; border-bottom: 1px solid #cccccc; font-weight: 400; font-style: normal; font-size: 1rem; line-height: 1.55rem;"&gt;&lt;TR style="border-bottom: none; text-align: left;"&gt;&lt;TD class="" style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;Property&lt;/TD&gt;&lt;TD class="" style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;Explanation&lt;/TD&gt;&lt;TD class="" style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;Data Type&lt;/TD&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY style="overflow: auto; width: 761.333px;"&gt;&lt;TR style="border-bottom: 1px solid #cccccc; text-align: left;"&gt;&lt;TD style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;areaFieldName&lt;DIV class=""&gt;(Read Only)&lt;/DIV&gt;&lt;/TD&gt;&lt;TD style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;&lt;P style="margin-top: 0px; margin-bottom: 0px;"&gt;The name of the geometry area field.&lt;/P&gt;&lt;/TD&gt;&lt;TD style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;String&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border-bottom: 1px solid #cccccc; text-align: left;"&gt;&lt;TD style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;lengthFieldName&lt;DIV class=""&gt;(Read Only)&lt;/DIV&gt;&lt;/TD&gt;&lt;TD style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;&lt;P style="margin-top: 0px; margin-bottom: 0px;"&gt;The name of the geometry length field.&lt;/P&gt;&lt;/TD&gt;&lt;TD style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;String&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2019 17:38:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attributes-from-layer-to-table-except-oid-and/m-p/557481#M43568</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-08-27T17:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attributes from layer to table except OID and Geometry</title>
      <link>https://community.esri.com/t5/python-questions/copy-attributes-from-layer-to-table-except-oid-and/m-p/557482#M43569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes that did it and 'Shape.STArea()' and fields.name != 'Shape.STLength()' would have probably worked too.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;fields.name for fields in fields if fields.name != desc.OIDFieldName and fields.type != 'Geometry' and fields.name != desc.areaFieldName and \
            flds.name != desc.lengthFieldName]‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:04:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attributes-from-layer-to-table-except-oid-and/m-p/557482#M43569</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-12T00:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attributes from layer to table except OID and Geometry</title>
      <link>https://community.esri.com/t5/python-questions/copy-attributes-from-layer-to-table-except-oid-and/m-p/557483#M43570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got a typeError&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;
fldnames = [fld.name for fld in flds if fld.name != desc['OIDFieldName'] and fld.type != 'Geometry']
TypeError: 'geoprocessing describe data object' object is not subscriptable&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:04:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attributes-from-layer-to-table-except-oid-and/m-p/557483#M43570</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-12T00:04:14Z</dc:date>
    </item>
  </channel>
</rss>

