I have received an odd error message recently when trying to set up a label expression in ArcMap using Python parser.
I have a field of
Double type and I want to show its value rounded in a label. Shouldn’t be more difficult than
But I am getting an error message:
The expression contains an error.
Modify the expression and try again.
Error 0 on line 0.
Error running expression: esri__FindLabel(ESRIExpressionArg0)
Traceback (most recent call last):
File “<expression>”, line 1, in <module>
File “<string>”, line 2, in esri__FindLabel
ValueError: invalid literal for int() with base 10: ‘6380,614’
This is interesting. As it turns out, the double field’s string representation is used during the evaluation. On a virtual machine I’ve used, the locale that I’ve used had a comma
, as the decimal symbol. So, in order to make it work I have to use the
Alternatively, if you want/can change the locale settings in Windows to use a dot
. instead of a comma
,, then you will not need to run the replace method. It would be sufficient to run
Small thing but hope this will save some time for other peer users!