this the area in my code that is giving me trouble. It has to do with import time vs from datetime import datetime, time . Apparently one makes one statement not callable and if I try to rearrange it makes another statment not callable. please refer to bottom for error codes. Any help will be glady appreciated enter code here
import time
from datetime import datetime, date , tzinfo, timedelta, time
from pytz import timezone
import pytz
from twitter import *
t = time(3,0,0,0)
print(t)
now = datetime.utcnow()
nowYear = int(now.year)
nowMonth = int(now.month)
nowDay = int(now.day)
nowHour = int(now.hour)
nowMin = int(now.minute)
nowSec = int(now.second)
now = datetime(nowYear, nowMonth, nowDay, nowHour , nowMin, nowSec, tzinfo=utc)
tomorrow = datetime(nowYear, nowMonth, nowDay +1, 7 , 0, 0, tzinfo=utc)
now = now.astimezone(timeZone)
#tomorrow = tomorrow.astimezone(timeZone)
print(now)
print(tomorrow)
delta = timedelta()
delta = tomorrow - now
deltaS = delta.total_seconds()
time.sleep(30)
if i rearrange the imports or delete one or import in the code i get one of these two errors raceback (most recent call last):
File "pract.py", line 164, in <module>
main()
File "pract.py", line 142, in main
t = time(3,0,0,0)
UnboundLocalError: local variable 'time' referenced before assignment
or
traceback (most recent call last):
File "pract.py", line 164, in <module>
main()
File "pract.py", line 142, in main
t = time(3,0,0,0)
UnboundLocalError: local variable 'time' referenced before assignment
Any help would be appreciated ladies and gents thank you for your time and look forward to the responses.