Hey I encounter a weird exception and don't know how to fix my code:
def start():
try:
from datetime import datetime
import pytz
import time
from pytz import country_timezones
productLaunchDate = "2023-03-22 09:00:00"
globalCountry = "GB"
timezone = country_timezones(globalCountry)[0]
currentTimezone = pytz.timezone(timezone)
time1 = datetime.now(currentTimezone)
print(time1)
time2 = datetime.strptime(productLaunchDate, '%Y-%m-%d %H:%M:%S')
print(time2)
if time1 > time2:
return
td = time2 - time1
for i in range(int(td.total_seconds()), 0, -1):
print(f'{i//3600} hours, {(i//60)%60} minutes, and {i%60} seconds')
time.sleep(1)
except Exception as e:
print(f"Error at wait -> {e}")
start()
Basically what I want to do is use a different country iso get the timezone and wait until the date, the productLaunchDate is already in the right timezone.