You are unnecessarily iterating over the contents of the row values. Lines like this:
for item in row[0]:
self.wfile.write("%s"% item)
Could likely be changed to
self.wlfile.write(row[0])
What you are doing, when row[x]
is a string is actually iterating over each letter and writing it. But row[2]
is a datetime.datetime object. And since datetime.datetime objects are not iterable, you get that error message.
Try instead something like:
self.wlfile.write((row[2]))
That places the datetime object in a tuple which can be iterated.