When I run my py script I receive the following error:
Traceback (most recent call last):
File "report_monitor.py", line 17, in <module>
timedelta(hours=7).time())
AttributeError: 'datetime.timedelta' object has no attribute 'time'
The code is below:
#!/usr/bin/python
import time
import MySQLdb
import datetime
from datetime import timedelta
db =
MySQLdb.connect("localhost","root","password","DB")
cursor = db.cursor()
cursor.execute("SELECT * FROM reportPref WHERE lastDate LIKE '2015-11-
18%'")
records = cursor.fetchall()
for record in records:
rec = record[14] #index 14 is a datetime object. there is no problem here.
schedLogTime =
(datetime.datetime.combine(datetime.date(1,1,1),rec.time()) -
timedelta(hours=7).time())
print schedLogTime
db.close()
What am I missing? This is driving me bonkers...!