I am trying to use a find label expression that changes the font of one field, [NUMBERNAME]. I am using the Python parser of ArcGIS 10.3.1 for Desktop.

All fields have a data type of text. This is what I have...

def FindLabel ([NUMBERNAME]):
    lineone = "A:"+ [NUMBER]
    absName = "<CLR red='255'><FNT size = '14'>" + [NUMBERNAME] + "</FNT></CLR>"
    if [NUMBERNAME] != None:
        return lineone + '\n' + absName + '\n' + "BLK:" + [BLOCK] + '\n' + "SEC:"+ [SURNUM] 

I am getting an error. Any thoughts as to what is wrong?


The expression contains an error. Modify the expression and try again. Error 0 on line 0. SyntaxError: invalid syntax(string, line 2).

enter image description here

  • Paste here this error.
    – dmh126
    Jul 10, 2015 at 18:29
  • You might find it simpler to use .format() : "{0}\n{1}\nBLK:{2}\nSEC:{3}".format(absName, [BLOCK], [SURNUM])
    – Paul
    Jul 13, 2015 at 18:15

2 Answers 2


You currently have:

lineone = "A:" + [NUMBER] but [NUMBER] isn't defined anywhere.

Any fields that you want to use in the expression, you need to include as a parameter to the function.

So, it looks like you would want:

def FindLabel ([NUMBERNAME], [NUMBER], [BLOCK], [SURNUM]):

You need to allow for [NUMBER], [BLOCK], and [SURNUM] in your function.


And make sure to account for None to be returned if any of those fields could be empty.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.