My objective is to change the values under field "DATE_IMPOR" which are currently set at to the current time using time.localtime function. I'm having some problems getting there, above all one line appears to be most problematic "row.setValue("DATE_IMPOR", new_time)".
The field data type of "DATE_IMPOR" is Date, therefore it has to be Date format such as YYYY or YYYY/MM/DD or types supported.
In short, what I get is a Runtime Error.
Here is my script so far:
import arcpy import time #environnement de travail arcpy.env.workspace = "D:/M1 Geomatique/Programmation II/Dossier" cursor = arcpy.UpdateCursor("ZONE_INONDATION_SYNTHESE_67.shp", "DATE_IMPOR") #Update cursor try: for row in cursor: new_time = time.localtime() row.setValue("DATE_IMPOR", new_time) cursor.updateRow() except: arcpy.GetMessages()
*One note: I wasn't sure where it would be better to ask this question, therefore I have placed it here as well. Apologises for that.