I have a Feature Class in a Geodatabase with an field for pipe diameter. I also have a shapefile with a field for diameter. The shapefile is from field verification work that verified a variety of pipe characteristics. I have joined the shapefile to the Feature Class in ArcMap, see the image below. I would like to recalculate using Field Calculator and the Python Parser the first diameter field with that information in the second diameter field, any null values would keep the original data in the first diameter field. Through some research I have hodgepodged the following script that fails upon execution when using the Filed Calculator. ArcMap spits out an Error:

Python syntax error: Parsing error SyntaxError: invalid syntax (line 1)

enter image description here

def IgnoreNull (GravitySewer.Diameter, assets.Diameter)
 if assets.Diameter is None:
      return GravitySewer.Diameter
      return assets.Diameter

enter image description here

  • 1
    Could you show how you execute the function?
    – Bera
    Commented Nov 16, 2017 at 14:07

1 Answer 1


You need to change bottom line in field calculator to:

IgnoreNull(!GravitySewer.Diameter!, !assets.Diameter!)

You could also have a problem with the dots in the function variable names. Try changing them in the codeblock to:

def IgnoreNull (GravitySewer_Diameter, assets_Diameter):
    if assets_Diameter is None:
        return GravitySewer_Diameter
        return assets_Diameter

You can name them whatever you want. It is when you call the function you need the real field names enclosed in !!

  • Thanks you for the reply, I tried what you mentioned with no luck. I also completely changed the names. ArcMap spits out an Error "Python syntax error: Parsing error SyntaxError: invalid sytax (line 1)
    – LandArch
    Commented Nov 16, 2017 at 14:43
  • @LandArch: Try again. I missed the colon ( : ) on the def... line
    – Bera
    Commented Nov 16, 2017 at 14:48

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.