<?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: Building label expresssion with standalone Python script ? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/building-label-expresssion-with-standalone-python/m-p/355844#M27975</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Xander&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I started programming in Python. I try to understand how best to use this language.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You just give me the answer to the first part of my problem. I thank you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The aim is for me now to write a script to compare my table with a table that will be updated a few times. I need to know what the new names in the table update. So as to complete the script for label expressions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If new objects as Egl. appear I know this first script will do the job. But how can I do if for example a new object complements my table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope to be clear enough&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Oct 2013 21:31:47 GMT</pubDate>
    <dc:creator>PierreWeisse</dc:creator>
    <dc:date>2013-10-29T21:31:47Z</dc:date>
    <item>
      <title>Building label expresssion with standalone Python script ?</title>
      <link>https://community.esri.com/t5/python-questions/building-label-expresssion-with-standalone-python/m-p/355842#M27973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I work on a table of about 1200 objects. I wonder if it is possible to write a standalone Python script to replace one word with another without changing the values ??????of my table. As building label expressions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="text-decoration:underline;"&gt;Exemple:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to replace &lt;/SPAN&gt;&lt;STRONG&gt;Ec.&lt;/STRONG&gt;&lt;SPAN&gt; for &lt;/SPAN&gt;&lt;STRONG&gt;Ecole&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="text-decoration:underline;"&gt;other exemple&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to replace &lt;/SPAN&gt;&lt;STRONG&gt;Egl.&lt;/STRONG&gt;&lt;SPAN&gt; for &lt;/SPAN&gt;&lt;STRONG&gt;Eglise&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Oct 2013 05:12:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/building-label-expresssion-with-standalone-python/m-p/355842#M27973</guid>
      <dc:creator>PierreWeisse</dc:creator>
      <dc:date>2013-10-29T05:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Building label expresssion with standalone Python script ?</title>
      <link>https://community.esri.com/t5/python-questions/building-label-expresssion-with-standalone-python/m-p/355843#M27974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I work on a table of about 1200 objects. I wonder if it is possible to write a standalone Python script to replace one word with another without changing the values �??�??of my table. As building label expressions.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="text-decoration:underline;"&gt;Exemple:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;I would like to replace &lt;STRONG&gt;Ec.&lt;/STRONG&gt; for &lt;STRONG&gt;Ecole&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="text-decoration:underline;"&gt;other exemple&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;I would like to replace &lt;STRONG&gt;Egl.&lt;/STRONG&gt; for &lt;STRONG&gt;Eglise&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks for your help&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Pierre,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess the expression that you're looking for is something along the lines of:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family:courier new;"&gt;replace(replace([&lt;STRONG&gt;yourLabelFieldName&lt;/STRONG&gt;],"Ec.","Ecole"),"Egl.","Eglise")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know why you want a standalone Python script to change the expression, but it could be something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

mxdPath = r"&lt;STRONG&gt;C:\Project\_LearnPython\Ohio2.mxd&lt;/STRONG&gt;"
layerName = "&lt;STRONG&gt;OH30&lt;/STRONG&gt;"
fldName = "&lt;STRONG&gt;yourLabelFieldName&lt;/STRONG&gt;"

# in case of shapefile of personal geodatabase
labelExpression = 'replace(replace([{0}],"Ec.","Ecole"),"Egl.","Eglise")'.format(fldName)

&lt;SPAN style="font-style:italic;"&gt;# in case of file geodatabase
# labelExpression = 'replace(replace("{0}","Ec.","Ecole"),"Egl.","Eglise")'.format(fldName)&lt;/SPAN&gt;

mxd = arcpy.mapping.MapDocument(mxdPath)
for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.name == layerName:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("LABELCLASSES"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.showLabels == True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lblClass in lyr.labelClasses:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lblClass.expression = labelExpression

mxd.save()
del mxd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Change the &lt;/SPAN&gt;&lt;STRONG&gt;bold&lt;/STRONG&gt;&lt;SPAN&gt; text to represent your situation. Activate the italic code in case your layer is in a file geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code will:&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;access your mxd&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;loop through the layer until it finds the &lt;SPAN style="font-style:italic;"&gt;layerName&lt;/SPAN&gt; provided&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;change the label expression of the layer&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;saves the mxd&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:39:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/building-label-expresssion-with-standalone-python/m-p/355843#M27974</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T16:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: Building label expresssion with standalone Python script ?</title>
      <link>https://community.esri.com/t5/python-questions/building-label-expresssion-with-standalone-python/m-p/355844#M27975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Xander&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I started programming in Python. I try to understand how best to use this language.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You just give me the answer to the first part of my problem. I thank you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The aim is for me now to write a script to compare my table with a table that will be updated a few times. I need to know what the new names in the table update. So as to complete the script for label expressions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If new objects as Egl. appear I know this first script will do the job. But how can I do if for example a new object complements my table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope to be clear enough&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Oct 2013 21:31:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/building-label-expresssion-with-standalone-python/m-p/355844#M27975</guid>
      <dc:creator>PierreWeisse</dc:creator>
      <dc:date>2013-10-29T21:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: Building label expresssion with standalone Python script ?</title>
      <link>https://community.esri.com/t5/python-questions/building-label-expresssion-with-standalone-python/m-p/355845#M27976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Xander&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As I started in Pyhon, I make mistakes. I want to make a standalone script to not update the data source. I don't know if it's the better solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In a second step I should compare my class annotation source with a class annotation update. And look at this update with the new data does not yet match.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I work from a class annotation. I don�??t want to change the data source, but simply change the label expression or display rather like my data is a class annotation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code returns me an error &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; mxdPath=r'M:\UTILISATEURS\Pierre\SERAIL\TEST.mxd'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; layerName=r'M:\UTILISATEURS\Pierre\SERAIL\MISE_A_JOUR.gdb\TEST'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; fldName="TEXTSTRING"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; labelExpression = 'replace(replace([{0}],"Ec.","Ecole"),"Egl.","Eglise")'.format(fldName)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; mxd = arcpy.mapping.MapDocument(mxdPath)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; for lyr in arcpy.mapping.ListLayers(mxd):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.name == layerName:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("LABELCLASSES"):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.showLabels == True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lblClass in lyr.labelClasses:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lblClass.expression = labelExpression&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; mxd.save()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &amp;lt;type 'exceptions.IOError'&amp;gt;: UNKNOWN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; del mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you write the code with my data, please. I tried this morning, but I don�??t understand why it doesn�??t work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My data&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mxdPath= r'M:\UTILISATEURS\Pierre\SERAIL\TEST.mxd'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;layerName = r'M:\UTILISATEURS\Pierre\SERAIL\MISE_A_JOUR.gdb\TEST'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fldName = "TEXTSTRING"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope to be clear enough&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 03:25:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/building-label-expresssion-with-standalone-python/m-p/355845#M27976</guid>
      <dc:creator>PierreWeisse</dc:creator>
      <dc:date>2013-10-30T03:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Building label expresssion with standalone Python script ?</title>
      <link>https://community.esri.com/t5/python-questions/building-label-expresssion-with-standalone-python/m-p/355846#M27977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The code returns me an error &lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt; Runtime error &amp;lt;type 'exceptions.IOError'&amp;gt;: UNKNOWN&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;layerName=r'M:\UTILISATEURS\Pierre\SERAIL\MISE_A_JOUR.gdb\TEST'&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I work from a class annotation. I don�??t want to change the data source,&amp;nbsp; but simply change the label expression or display rather like my data is&amp;nbsp; a class annotation.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Pierre,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I notice your layername. I used the name of the layer as it appears in the table of contents (TOC) of the mxd. You are using a reference to the data source itself and that's probably not how the layer is named in the TOC. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So change this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;layerName=r'M:\UTILISATEURS\Pierre\SERAIL\MISE_A_JOUR.gdb\TEST'&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;to this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;layerName='TEST'&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;... if your layer is called 'TEST' in the TOC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could also try with manually entering the label expression below in the layer properties:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family:courier new;"&gt;replace(replace([TEXTSTRING],"Ec.","Ecole"),"Egl.","Eglise")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The error &lt;/SPAN&gt;&lt;SPAN style="font-family:courier new;"&gt;Runtime error &amp;lt;type 'exceptions.IOError'&amp;gt;: UNKNOWN&lt;/SPAN&gt;&lt;SPAN&gt; you obtained refers to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Raised when an I/O operation (such as a print statement, the built-in open() function or a method of a file object) fails for an I/O-related reason, e.g., "file not found" or "disk full".&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have write permissions to save the mxd?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But the biggest difference is that you are not labeling based on a field, but you have an (feature-linked?) annotation class. This works completely different. In stead of a label expression there is the "Display Expression". This display expression is not (yet) supported by arcpy. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case the best thing you can do is manually enter the properties of the annotation class and activate the Display TAB and press the Expression button:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28710[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the Display Expression dialog enter the expression:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family:courier new;"&gt;replace(replace([TEXTSTRING],"Ec.","Ecole"),"Egl.","Eglise")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28711[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When there are more parts of text you want to change in the feature, it may be better to use a multiline expression like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel ( [TextString] )
&amp;nbsp; Label = replace([TextString], "Ec.", "Ecole")
&amp;nbsp; Label = replace(Label, "Egl.", "Eglise")
&amp;nbsp; Label = replace(Label, "&lt;SPAN style="font-style:italic;"&gt;Text to search for&lt;/SPAN&gt;", "&lt;SPAN style="font-style:italic;"&gt;Text to replace it with&lt;/SPAN&gt;")
&amp;nbsp; '&lt;SPAN style="font-style:italic;"&gt;etc&lt;/SPAN&gt;
&amp;nbsp; FindLabel = Label
End Function
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried this with a dummy dataset and if I hit the "Verify" button it shows the replaced text correctly. If I look at the map however it doesn't display the changed text. Please note that I switched on the option "&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Show MapTips using the display expression&lt;/SPAN&gt;&lt;SPAN&gt;"... See steps below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28714[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is even stranger, when I hover over the text in the map it shows a kind of tool tip with the corrected text...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is odd.. maybe you're better of not using annotation...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:39:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/building-label-expresssion-with-standalone-python/m-p/355846#M27977</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T16:39:49Z</dc:date>
    </item>
  </channel>
</rss>

