<?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: Invert where clause error on Select by attributes in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122332#M9506</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you need to add a &lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-feature-layer.htm"&gt;make feature layer&lt;/A&gt;&amp;nbsp;step in there.&amp;nbsp; This is a case where the model to python conversion isn't 100%.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This line in the error is the kicker:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;The value cannot be a feature &lt;SPAN class="keyword token"&gt;class&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Jul 2020 16:46:38 GMT</pubDate>
    <dc:creator>JoeBorgione</dc:creator>
    <dc:date>2020-07-07T16:46:38Z</dc:date>
    <item>
      <title>Invert where clause error on Select by attributes</title>
      <link>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122327#M9501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am running a script that was exported directly from model builder in Pro.&amp;nbsp; It runs this select by attributes statement and gives me an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Select Layer By Attribute (Select Layer By Attribute) &lt;BR /&gt; DBO_wHydrantInspection_Layer, Count = arcpy.SelectLayerByAttribute_management(in_layer_or_view=GISDefault_DBO_wHydrantInspection, selection_type="NEW_SELECTION", where_clause="REPAIR = 'Yes'", invert_where_clause="")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; File "H:\Python\HydrantRepairPro.py", line 25, in &amp;lt;module&amp;gt;&lt;BR /&gt; Model()&lt;BR /&gt; File "H:\Python\HydrantRepairPro.py", line 16, in Model&lt;BR /&gt; DBO_wHydrantInspection_Layer, Count = arcpy.SelectLayerByAttribute_management(in_layer_or_view=GISDefault_DBO_wHydrantInspection, selection_type="NEW_SELECTION", where_clause="REPAIR = 'Yes'", invert_where_clause="")&lt;BR /&gt;TypeError: SelectLayerByAttribute() got an unexpected keyword argument 'invert_where_clause'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know why the invert&amp;nbsp; where cause is throwing an error?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2020 16:16:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122327#M9501</guid>
      <dc:creator>CassidyKillian</dc:creator>
      <dc:date>2020-07-07T16:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Invert where clause error on Select by attributes</title>
      <link>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122328#M9502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you using Pro?&amp;nbsp; The parameter in question is only supported in Pro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2020 16:24:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122328#M9502</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-07-07T16:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Invert where clause error on Select by attributes</title>
      <link>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122329#M9503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I built the model in pro and exported to a python script that I need to run as a scheduled task.&amp;nbsp; When I tried to run the script in IDLE it gave me the error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2020 16:27:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122329#M9503</guid>
      <dc:creator>CassidyKillian</dc:creator>
      <dc:date>2020-07-07T16:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Invert where clause error on Select by attributes</title>
      <link>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122330#M9504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The options for that parameter are&lt;/P&gt;&lt;TABLE style="color: #4c4c4c; background-color: #ffffff; border: 1px solid #cccccc; font-size: 0.875rem; margin-bottom: 1.55rem;"&gt;&lt;TBODY&gt;&lt;TR style="border-bottom: none;"&gt;&lt;TD class="" style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.51667rem;"&gt;&lt;DIV class=""&gt;inert_where_clause&lt;/DIV&gt;&lt;DIV class=""&gt;(Optional)&lt;/DIV&gt;&lt;/TD&gt;&lt;TD style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.51667rem;"&gt;&lt;P&gt;Specifies whether the result of the expression should be inverted.&lt;/P&gt;&lt;DIV class=""&gt;&lt;UL style="font-size: 0.9375rem; margin-left: 0.775rem; margin-bottom: 1.55rem;"&gt;&lt;LI style="margin: 0.3875rem 0px 0.3875rem 1.5rem;"&gt;&lt;SPAN&gt;NON_INVERT&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;—&lt;SPAN&gt;The result of the query will be used as is. This is the default.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin: 0.3875rem 0px 0.3875rem 1.5rem;"&gt;&lt;SPAN&gt;INVERT&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;—&lt;SPAN&gt;The result of the query will be inverted. If the&amp;nbsp;&lt;SPAN class=""&gt;selection_type&lt;/SPAN&gt;&amp;nbsp;parameter is used, the inversion occurs before the selection is combined with existing selections.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;not "".&amp;nbsp; Leave it out altogether if NON_INVERT is what you want.&amp;nbsp; You don't need to specify parameters if you are using named parameters and using defaults.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2020 16:30:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122330#M9504</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-07-07T16:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Invert where clause error on Select by attributes</title>
      <link>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122331#M9505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan,&lt;/P&gt;&lt;P&gt;I removed the invert clause statement so not it looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Select Layer By Attribute (Select Layer By Attribute) &lt;BR /&gt; DBO_wHydrantInspection_Layer, Count = arcpy.SelectLayerByAttribute_management(in_layer_or_view=GISDefault_DBO_wHydrantInspection, selection_type="NEW_SELECTION", where_clause="REPAIR = 'Yes'")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now it gives me this error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; File "H:\Python\HydrantRepairPro.py", line 25, in &amp;lt;module&amp;gt;&lt;BR /&gt; Model()&lt;BR /&gt; File "H:\Python\HydrantRepairPro.py", line 16, in Model&lt;BR /&gt; DBO_wHydrantInspection_Layer, Count = arcpy.SelectLayerByAttribute_management(in_layer_or_view=GISDefault_DBO_wHydrantInspection, selection_type="NEW_SELECTION", where_clause="REPAIR = 'Yes'")&lt;BR /&gt; File "C:\Program Files (x86)\ArcGIS\Desktop10.7\ArcPy\arcpy\management.py", line 7737, in SelectLayerByAttribute&lt;BR /&gt; raise e&lt;BR /&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;BR /&gt;The value cannot be a feature class&lt;BR /&gt;ERROR 000840: The value is not a Raster Layer.&lt;BR /&gt;ERROR 000840: The value is not a Mosaic Layer.&lt;BR /&gt;Failed to execute (SelectLayerByAttribute).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2020 16:44:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122331#M9505</guid>
      <dc:creator>CassidyKillian</dc:creator>
      <dc:date>2020-07-07T16:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Invert where clause error on Select by attributes</title>
      <link>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122332#M9506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you need to add a &lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-feature-layer.htm"&gt;make feature layer&lt;/A&gt;&amp;nbsp;step in there.&amp;nbsp; This is a case where the model to python conversion isn't 100%.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This line in the error is the kicker:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;The value cannot be a feature &lt;SPAN class="keyword token"&gt;class&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2020 16:46:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122332#M9506</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-07-07T16:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Invert where clause error on Select by attributes</title>
      <link>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122333#M9507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As an FYI, the trackback is showing you are running the code from ArcGIS Desktop/ArcMap and not Pro, which is why your original code failed because of the parameter difference.&amp;nbsp; Also, it could be why the code is failing now since Select Layer By Attribute handled data set inputs differently between ArcMap and Pro. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run the original code from Python bundled with Pro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2020 18:35:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invert-where-clause-error-on-select-by-attributes/m-p/122333#M9507</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-07-07T18:35:40Z</dc:date>
    </item>
  </channel>
</rss>

