ArcGIS Field Calculator using Python Parser gives ERROR 000989

arcgis-desktoparcmaperror-000989field-calculatorpython-parser

I am attempting to learn how to update a field using Python with Codeblock showing.

The script is supposed to return a value to a text field based on a numerical value in two float fields but I keep getting an error:

Pre-Logic Script Code:

def wType(SWPULP):

    if SWPULP>=75:
        return "SP"
    elseif HWPULP>=75:
        return "HP"
    else:
        return "MW"

Expression

STANDTYPE = wType(!SWPULP!)

error message:

ERROR 000989: Python syntax error: Parsing error SyntaxError: invalid syntax (line 4)

I have standard 4 space indent (solved that error previously) but now I am stuck as to why it will not work.

SCREENSHOTenter image description here

Best Answer

The syntax should be:

def wType(SWPULP, HWPULP):
    if SWPULP>=75:
        return "SP"
    elif HWPULP>=75:
        return "HP"
    else:
        return "MW"

Call with:

wType(!SWPULP!, !HWPULP!)
Related Question