shakir

using update cursor from python script

Discussion created by shakir on Jan 31, 2014
Latest reply on Jan 31, 2014 by shakir
Hi I am trying to update a field from File geodatabase using update cursor using where clause. but the search string has quote. I tried all different way to use where clause but did not work.  I really apprecaite if anyone can help me to solve this problem or work around.

Thanks

===============================
Here is the code that I am using from python win.
===============================

>>>my_name = "New Horizon's place.JPG"
>>> where = Name =  '"%s"'  %my_name
>>> cursor2 = arcpy.UpdateCursor(my_feature,where)

Traceback (most recent call last):

  File "<interactive input>", line 1, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\__init__.py", line 1165, in UpdateCursor
    return gp.updateCursor(dataset, where_clause, spatial_reference, fields, sort_fields)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 364, in updateCursor
    self._gp.UpdateCursor(*gp_fixargs(args, True)))
RuntimeError: ERROR 999999: Error executing function.
An invalid SQL statement was used.
An invalid SQL statement was used. [my_feature]
An invalid SQL statement was used. [SELECT * FROM my_feature WHERE ( "New Horizon's place.JPG" )]

Outcomes