I'm trying to make a four character output based on concatenating a single character field (in1) with either 1 or 2 zeros, depending on the length of in2, and then concatenating that . I'm getting an indention error on this but I can't see where. I looked at the other posts with this issue and none of their solutions are working for me.
def fixRouteName( in1, in2, out ): if len(in1) == 2: out = in1 + "0" + in2 elif len(in2) < 2: out = in1 + "00" + in2 else: out = in1 + in2 return out __esri_field_calculator_splitter__ fixRouteName( !Exist_Partition! , !Exist_Route! , !Route! )
Here is the error message:
Description The code block used by the Calculate Field or Calculate Value tool has a syntax error. This error message provided will list the specific Python syntax error.
Solution This error code covers a number of Python syntax errors, for example, Parsing error: unindent does not match any outer indentation level (line 3).
The above is a Python syntax error. Line 3 has invalid indentation. For specific Python issues, consult the Python documentation for more information, or consult the Calculate Field, Calculate Value, or Analyze Tools For Pro help for more information on these tools.
When returned by a script tool or when evaluating a script tool using Analyze Tools For Pro, this error can also indicate that the tool's source script cannot be found.