mykonosman

EOL calculating field, single quoted - scrubbing addresses

Discussion created by mykonosman on May 10, 2011
Latest reply on May 11, 2011 by mykonosman
Would anyone be able to point me in the right direction ?  I need to figure out how to either make the script ignore these errors and continue to run, or actually be able to handle these lines that currently shut down the script.




C:\ZP4>call housenumberzero.bat

C:\ZP4>C:\Python24\HOUSENUMERZERO.py
C:\ZP4\49003
C:\ZP4\49053
Traceback (most recent call last):
  File "C:\Python24\HOUSENUMERZERO.py", line 21, in <module>
    gp.CalculateField_management(fc + "\\Parcels.shp", "SIT_FULL_S", "myfunction(!SIT_HSE_NU!,!SIT_FULL_S!)", "PYTHON", "def myfunction(fld1,fld2):\n  if (fld1=='0'or fld1=='00'or fld1<'00000000000'):\n    return ''\n  else:\n    return fld2")
arcgisscripting.ExecuteError: ERROR 000539: Error running expression: myfunction("69","69 FLOOD ST

") <type 'exceptions.SyntaxError'>: EOL while scanning single-quoted string (<string>, line 1)
Failed to execute (CalculateField).


C:\ZP4>call 1LowerCaseSitusFull.bat

C:\ZP4>C:\Python24\SITUSLOWERPYTON.py
C:\ZP4\49003
C:\ZP4\49053
Traceback (most recent call last):
  File "C:\Python24\SITUSLOWERPYTON.py", line 17, in <module>
    gp.CalculateField_management(fc + "\\Parcels.shp", "SIT_FULL_S", "!SIT_FULL_S!.title()", "PYTHON", "")
arcgisscripting.ExecuteError: ERROR 000539: Error running expression: "69 FLOOD ST

".title() <type 'exceptions.SyntaxError'>: EOL while scanning single-quoted string (<string>, line 1)
Failed to execute (CalculateField).

Outcomes