<?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 ArcGIS Pro: layer.supports...the check works, then fails when trying to read that same property!??!? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcgis-pro-layer-supports-the-check-works-then/m-p/1096241#M62268</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;for lyr in updateMap.listLayers():&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if lyr.supports("DATASOURCE"):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;arcpy.AddMessage(lyr.dataSource)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;A script opens an ArcGIS Pro project file, goes through the list of layers within a map, checks to see if each layer supports the 'DataSource' property before giving me a message with that datasource&lt;/P&gt;&lt;P&gt;The script fails as it reaches a layer which doesn't support the 'DataSource' property....&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;&lt;SPAN class="error-link"&gt;NameError: The attribute 'dataSource' is not supported on this instance of Layer.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Can someone explain this non-sensical behaviour to me?&lt;/P&gt;&lt;P&gt;ArcGIS Pro 2.8.2&lt;/P&gt;</description>
    <pubDate>Wed, 08 Sep 2021 05:08:26 GMT</pubDate>
    <dc:creator>GeoNZ</dc:creator>
    <dc:date>2021-09-08T05:08:26Z</dc:date>
    <item>
      <title>ArcGIS Pro: layer.supports...the check works, then fails when trying to read that same property!??!?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-layer-supports-the-check-works-then/m-p/1096241#M62268</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;for lyr in updateMap.listLayers():&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if lyr.supports("DATASOURCE"):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;arcpy.AddMessage(lyr.dataSource)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;A script opens an ArcGIS Pro project file, goes through the list of layers within a map, checks to see if each layer supports the 'DataSource' property before giving me a message with that datasource&lt;/P&gt;&lt;P&gt;The script fails as it reaches a layer which doesn't support the 'DataSource' property....&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;&lt;SPAN class="error-link"&gt;NameError: The attribute 'dataSource' is not supported on this instance of Layer.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Can someone explain this non-sensical behaviour to me?&lt;/P&gt;&lt;P&gt;ArcGIS Pro 2.8.2&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 05:08:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-layer-supports-the-check-works-then/m-p/1096241#M62268</guid>
      <dc:creator>GeoNZ</dc:creator>
      <dc:date>2021-09-08T05:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro: layer.supports...the check works, then fails when trying to read that same property!??!?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-layer-supports-the-check-works-then/m-p/1096246#M62269</link>
      <description>&lt;P&gt;I have no idea why this happens, but to not let it fail your script, you can do it in a try-catch block:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for lyr in updateMap.listLayers():
    try:
        arcpy.AddMessage(lyr.dataSource)
    except NameError:
        pass&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 08 Sep 2021 05:30:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-layer-supports-the-check-works-then/m-p/1096246#M62269</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-09-08T05:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro: layer.supports...the check works, then fails when trying to read that same property!??!?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-layer-supports-the-check-works-then/m-p/1096275#M62270</link>
      <description>&lt;P&gt;from&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/layer-class.htm" target="_blank" rel="noopener"&gt;Layer—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;could it be your layer source?&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;dataSource&lt;DIV class="paramhint"&gt;(Read Only)&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Returns the complete path for the layer's data source. It includes the full workspace path and name of the dataset. For enterprise geodatabase layers, a string containing the layer's connection information is returned.&lt;/P&gt;&lt;DIV&gt;&lt;H5&gt;Tip:&lt;/H5&gt;&lt;P&gt;Enterprise geodatabase layers in an&amp;nbsp;ArcGIS Pro&amp;nbsp;project do not retain the path to the database connection file (.sde) that was used to create the layer.&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;Strin&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 08 Sep 2021 09:18:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-layer-supports-the-check-works-then/m-p/1096275#M62270</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-09-08T09:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro: layer.supports...the check works, then fails when trying to read that same property!??!?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-layer-supports-the-check-works-then/m-p/1097494#M62362</link>
      <description>&lt;P&gt;Possible (and I'll check) but not likely as all the layers that I check (using a query on the list layers) are in the same location (default.gdb)...but even then, the whole point of 'supports' is that this type of error doesn't occur.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Sep 2021 21:59:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-layer-supports-the-check-works-then/m-p/1097494#M62362</guid>
      <dc:creator>GeoNZ</dc:creator>
      <dc:date>2021-09-12T21:59:19Z</dc:date>
    </item>
  </channel>
</rss>

