I have several shape files (all Parcels.shp) that I run scripts on in an attempt to clean and standardize the address field (SIT_FULL_S). Whenever a record has a double quotation, I get an error and the script shuts down.
Here is what I am using:
gp.CalculateField_management(fc + "\\Parcels.shp", "SIT_FULL_S", "!SIT_FULL_S!.replace(u'\u0022',u'\u0027')", "PYTHON", "")
example 1 - Script works with this text: 125 South Main Street
example 2 - Script shuts down with this text: 125 South "Main Street"
When I try example 1, the scripts runs.
When I try example 2, the script quits with Error 000539
Long story short, how can I remove any occurances of " from my field so that I can run my address scrubbing scripts ?
Or perhaps I should ask how to modify my below script to ignore the " and continue running. Here is an example of one of my address scrubbing scripts and the log showing the error:
gp.CalculateField_management(fc + "\\Parcels.shp","SIT_FULL_S", "!SIT_FULL_S!.lstrip('0')", "PYTHON")
arcgisscripting.ExecuteError: ERROR 000539: Error running expression: "9030 W SR 2 HWY "A"".lstrip('0') <type 'exceptions.SyntaxError'>: invalid syntax (<string>, line 1)
Failed to execute (CalculateField).