I'm trying to set units to a string and then as a parameter. The EsriTimeDelta syntax is EsriTimeDelta (interval, units)
When I run the code below in a script tool I keep getting an error message for the units, it will fail to run the script.
If there is an easier way please help! I need this question answered by Monday.
In this code I get an error saying that the interval must be a float. But the interval (double) units (string) according to the help.
I also didn't set the units to a string in this instance and the script would actually run. But now I'm getting the error I just mentioned.
When I run the code below in a script tool I keep getting an error message for the units, it will fail to run the script.
If there is an easier way please help! I need this question answered by Monday.
Code:
df.time.currentTime = datetime.datetime(2009, 01, 1, 00, 00)
endTime = datetime.datetime(2009, 01, 1, 23, 59)
tsi = arcpy.GetParameterAsText(1)
units = "'" + arcpy.GetParameterAsText(2)
interval = arcpy.time.EsriTimeDelta(tsi, units)I also didn't set the units to a string in this instance and the script would actually run. But now I'm getting the error I just mentioned.
Code:
df.time.currentTime = datetime.datetime(2009, 01, 1, 00, 00)
endTime = datetime.datetime(2009, 01, 1, 23, 59)
tsi = arcpy.GetParameterAsText(1)
units = arcpy.GetParameterAsText(2)
interval = arcpy.time.EsriTimeDelta(tsi, units)
count = 0
while df.time.currentTime <= endTime:
fileName = str(df.time.currentTime).split(" ")[0] + str(count) + ".jpg"
arcpy.mapping.ExportToJPEG(mxd, os.path.join(inFolder, fileName), data_frame)
df.time.currentTime = df.time.currentTime + interval
count += 1