<?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: ArcGIS Pro 3.0.4 - Python Script Failing for Labels in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268158#M66680</link>
    <description>&lt;P&gt;I'm no Python expert but I have used expressions for labeling and I have used the FindLabel function like you shared in your graphic. To my knowledge, that isn't the syntax for python. That is the syntax for VBScript.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Mar 2023 17:56:51 GMT</pubDate>
    <dc:creator>SLouq</dc:creator>
    <dc:date>2023-03-15T17:56:51Z</dc:date>
    <item>
      <title>ArcGIS Pro 3.0.4 - Python Script Failing for Labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268077#M66665</link>
      <description>&lt;P&gt;I recently upgraded from 2.7 to 3.0.4. This code worked perfectly in 2.7 but seems to have stopped working after I upgraded. I've seen similar posts to this but I don't know if the issue was ever resolved.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel ( [SURFACTANTS], [AMMONIA], [CHLORINE] ):
surf, amm, chlor = "","",""
if float([SURFACTANTS]) &amp;gt;0.24:
surf = "Surfactants: " + [SURFACTANTS] + "\n"
if float([AMMONIA]) &amp;gt;= 0.5:
amm = "Ammonia: " + [AMMONIA] + "\n"
if float([CHLORINE]) &amp;gt;= 0.02:
chlor = "Chlorine: " + [CHLORINE]

return surf + amm + chlor&lt;/LI-CODE&gt;&lt;P&gt;The error message I'm getting is:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Invalid expression.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;Error on line 1.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;Semicolon or new line expected&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I'm not sure where a semicolon or new line is expected, but I'm hoping it's an easy fix&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 15:38:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268077#M66665</guid>
      <dc:creator>AnthonyBomba</dc:creator>
      <dc:date>2023-03-15T15:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.0.4 - Python Script Failing for Labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268084#M66667</link>
      <description>&lt;P&gt;If you are using a python parser and these&lt;/P&gt;&lt;PRE&gt;[SURFACTANTS], [AMMONIA], [CHLORINE]&lt;/PRE&gt;&lt;P&gt;are supposed to be field names, you need to replace [] with surrounding ! !&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 15:47:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268084#M66667</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-03-15T15:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.0.4 - Python Script Failing for Labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268095#M66669</link>
      <description>&lt;P&gt;I am using a python parser and I just included surrounding ! ! but I still seem to be getting the same error message. One additional thing to note is that in previous versions the "def" in def FindLabel was highlighted blue (assuming it's a function), but that doesn't happen in the current version. Could the issue in line 1 be there?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 16:02:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268095#M66669</guid>
      <dc:creator>AnthonyBomba</dc:creator>
      <dc:date>2023-03-15T16:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.0.4 - Python Script Failing for Labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268131#M66675</link>
      <description>&lt;P&gt;along with the fields as&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp; mentioned, it appears as if it has lost it's indentation (at least in the pasted example).&lt;/P&gt;&lt;P&gt;Need to indent everything below line one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 17:11:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268131#M66675</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2023-03-15T17:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.0.4 - Python Script Failing for Labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268147#M66677</link>
      <description>&lt;P&gt;Thank you for the help&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/15530"&gt;@RhettZufelt&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;. Here is what the code looks like now&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel ( !SURFACTANTS!, !AMMONIA!, !CHLORINE! ):
    surf, amm, chlor = "","",""
    if float(!SURFACTANTS!) &amp;gt;0.24:
        surf = "Surfactants: " + !SURFACTANTS! + "\n"
    if float(!AMMONIA!) &amp;gt;= 0.5:
        amm = "Ammonia: " + !AMMONIA! + "\n"   
    if float(!CHLORINE!) &amp;gt;= 0.02:
        chlor = "Chlorine: " + !CHLORINE!

    return surf +  amm + chlor&lt;/LI-CODE&gt;&lt;P&gt;I still seem to be getting the same error message though.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 17:30:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268147#M66677</guid>
      <dc:creator>AnthonyBomba</dc:creator>
      <dc:date>2023-03-15T17:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.0.4 - Python Script Failing for Labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268156#M66679</link>
      <description>&lt;P&gt;Well, it appears as if Pro labeling likes the [] instead of !! for the field names, However, the only&amp;nbsp; way I get the same error message is if I fail to switch the language to Python "before" I paste in the code.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel ( [SURFACTANTS], [AMMONIA], [CHLORINE] ):
    surf, amm, chlor = "","",""
    if float([SURFACTANTS]) &amp;gt;0.24:
        surf = "Surfactants: " + [SURFACTANTS] + "\n"
    if float([AMMONIA]) &amp;gt;= 0.5:
         amm = "Ammonia: " + [AMMONIA] + "\n"
    if float([CHLORINE]) &amp;gt;= 0.02:
         chlor = "Chlorine: " + [CHLORINE]
    return surf + amm + chlor&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RhettZufelt_0-1678902633032.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/65359i1F6D580CDD04412C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RhettZufelt_0-1678902633032.png" alt="RhettZufelt_0-1678902633032.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 17:51:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268156#M66679</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2023-03-15T17:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.0.4 - Python Script Failing for Labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268158#M66680</link>
      <description>&lt;P&gt;I'm no Python expert but I have used expressions for labeling and I have used the FindLabel function like you shared in your graphic. To my knowledge, that isn't the syntax for python. That is the syntax for VBScript.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 17:56:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268158#M66680</guid>
      <dc:creator>SLouq</dc:creator>
      <dc:date>2023-03-15T17:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.0.4 - Python Script Failing for Labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268165#M66681</link>
      <description>&lt;P&gt;I thought that the variables were being called with VBScript syntax, but according to &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/mapping/text/specify-text-for-labels.htm" target="_self"&gt;the documenation&lt;/A&gt;, and the fact that clicking/building it in Pro's label editor populates it this way, I tried it and it works.&amp;nbsp; It appears as if the python syntax/variable delineators are different in label expressions vs calculate epxressions (where fields are referenced with !field!).&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 18:14:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268165#M66681</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2023-03-15T18:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.0.4 - Python Script Failing for Labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268166#M66682</link>
      <description>&lt;P&gt;This fixed it! I'm glad it was something small like that and not a syntax error. Appreciate the help!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 18:16:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268166#M66682</guid>
      <dc:creator>AnthonyBomba</dc:creator>
      <dc:date>2023-03-15T18:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.0.4 - Python Script Failing for Labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268171#M66683</link>
      <description>&lt;P&gt;glad it worked!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 18:25:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-3-0-4-python-script-failing-for-labels/m-p/1268171#M66683</guid>
      <dc:creator>SLouq</dc:creator>
      <dc:date>2023-03-15T18:25:24Z</dc:date>
    </item>
  </channel>
</rss>

