I am novice in python and I am trying to run a function in the field calculator and I get this error. It drives me nuts. What is wrong?
Thank you.
Error:
error 000539: syntaxerror: invalid syntax (<expression>, line 1)
Pre-Logic Script Code:
def fnfindstation(addstation):
if addstation == "151" or addstation == "551":
formataddress ="Oleander Station 1 - Shift B"
elif addstation == "152" or addstation == "552":
formataddress ="Oleander Station 2 - Shift B"
else:
formataddress = "Outside Station"
return formataddress
Station =
fnfindstation=( !district!)
Solved! Go to Solution.
since you are calling a function on a field, there is no need for an equal sign, since you are not setting a variable in your expression.
instead of
fnfindstation=( !district!)
try
fnfindstation(!district!)
since you are calling a function on a field, there is no need for an equal sign, since you are not setting a variable in your expression.
instead of
fnfindstation=( !district!)
try
fnfindstation(!district!)
Huh... I knew it was something simple.. has to get used to Python since it is so different that other languages. Thank you.