I’m getting an error while running this code. it shows that schedule library does not have a function called every(). I have tried to resolve the issue by upgrading the schedule library, but still problem persists.
<code>def schedule_email_notification(event_title, email, date, time_to_send, location, notes):
def job():
subject = f"Reminder : {event_title}"
body = f"Event '{event_title} is scheduled at {location}. nnDetails:n{notes}"
send_email(subject, body, email)
date_time_str = f"{date} {time_to_send}"
event_datetime = datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S')
schedule_time = event_datetime.strftime('%h:%M')
schedule.every().day.at(schedule_time).do(job)
while True:
schedule.run_pending()
time.sleep(1)
</code>
<code>def schedule_email_notification(event_title, email, date, time_to_send, location, notes):
def job():
subject = f"Reminder : {event_title}"
body = f"Event '{event_title} is scheduled at {location}. nnDetails:n{notes}"
send_email(subject, body, email)
date_time_str = f"{date} {time_to_send}"
event_datetime = datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S')
schedule_time = event_datetime.strftime('%h:%M')
schedule.every().day.at(schedule_time).do(job)
while True:
schedule.run_pending()
time.sleep(1)
</code>
def schedule_email_notification(event_title, email, date, time_to_send, location, notes):
def job():
subject = f"Reminder : {event_title}"
body = f"Event '{event_title} is scheduled at {location}. nnDetails:n{notes}"
send_email(subject, body, email)
date_time_str = f"{date} {time_to_send}"
event_datetime = datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S')
schedule_time = event_datetime.strftime('%h:%M')
schedule.every().day.at(schedule_time).do(job)
while True:
schedule.run_pending()
time.sleep(1)
Does anyone have any other suggestions other than schedule?
3