<?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: AttributeError when using updateConnectionProperties in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/attributeerror-when-using/m-p/1524411#M71280</link>
    <description>&lt;P&gt;I've been running into a similar issue. At first I thought it was the upgrade from 3.2.0 to 3.2.2, because my code worked before. However, the solution for me was to update the connection properties on the layer file. I'm working within a toolbox within the project, and I don't know if this will work if you are running a script outside the project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;proj = arcpy.mp.ArcGISProject("CURRENT")
current_map = proj.createMap("Name for the map")
current_map.openView()
lyrx = arcpy.mp.LayerFile(path to layer file)
_layer = current_map.addLayer(lyrx)[0]
cp = {'dataset': name of the feature class, 'workspace_factory': 'File Geodatabase', 'connection_info': {'database': path to the file geodatabase}}
lyrx.updateConnectionProperties(None, cp)
_layer = current_map.addLayer(lyrx)[0]
_layer.name = nm&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Aug 2024 15:09:34 GMT</pubDate>
    <dc:creator>dslamb2022</dc:creator>
    <dc:date>2024-08-20T15:09:34Z</dc:date>
    <item>
      <title>AttributeError when using updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-when-using/m-p/1513378#M71173</link>
      <description>&lt;P&gt;I'm encountering an AttributeError&amp;nbsp;when calling updateConnectionPropertieson a layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This error is also inconsistent:&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;It appears sporadically.&amp;nbsp;I've run the tool with the exact same inputs and it has worked.&amp;nbsp;Then, I'll run the tool again, and it will give me this error.&lt;/LI&gt;&lt;LI&gt;I've also tried iteratively calling the method on copies of the layer within a for loop, using the same&amp;nbsp;connection properties dictionary and new connection properties dictionary. It may succeed for a few times before failing.&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;There is also no descriptive error message (it just says AttributeError).&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;I've verified that:&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;The layer object is of type arcpy._mp.Layer&lt;/LI&gt;&lt;LI&gt;updateConnectionProperties is listed among the object's valid attributes and methods&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IT_AppLayers_1-1722478560328.png" style="width: 766px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/111307iED60F6FDB5A8964E/image-dimensions/766x517?v=v2" width="766" height="517" role="button" title="IT_AppLayers_1-1722478560328.png" alt="IT_AppLayers_1-1722478560328.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 04:37:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-when-using/m-p/1513378#M71173</guid>
      <dc:creator>IT_AppLayers</dc:creator>
      <dc:date>2024-08-01T04:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError when using updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-when-using/m-p/1513606#M71177</link>
      <description>&lt;P&gt;Is it maybe a group layer or something?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 13:54:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-when-using/m-p/1513606#M71177</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2024-08-01T13:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError when using updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-when-using/m-p/1524411#M71280</link>
      <description>&lt;P&gt;I've been running into a similar issue. At first I thought it was the upgrade from 3.2.0 to 3.2.2, because my code worked before. However, the solution for me was to update the connection properties on the layer file. I'm working within a toolbox within the project, and I don't know if this will work if you are running a script outside the project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;proj = arcpy.mp.ArcGISProject("CURRENT")
current_map = proj.createMap("Name for the map")
current_map.openView()
lyrx = arcpy.mp.LayerFile(path to layer file)
_layer = current_map.addLayer(lyrx)[0]
cp = {'dataset': name of the feature class, 'workspace_factory': 'File Geodatabase', 'connection_info': {'database': path to the file geodatabase}}
lyrx.updateConnectionProperties(None, cp)
_layer = current_map.addLayer(lyrx)[0]
_layer.name = nm&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 15:09:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-when-using/m-p/1524411#M71280</guid>
      <dc:creator>dslamb2022</dc:creator>
      <dc:date>2024-08-20T15:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError when using updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-when-using/m-p/1543247#M72951</link>
      <description>&lt;P&gt;I was also having this issue, and selecting the layer by using listLayers() instead of defining it when added solved it!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 22:36:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-when-using/m-p/1543247#M72951</guid>
      <dc:creator>MAmbrosini</dc:creator>
      <dc:date>2024-09-26T22:36:53Z</dc:date>
    </item>
  </channel>
</rss>

