print "[-] Invalid due date in line `{}`!".format(task) exit() if "fixed " == desc[:len("fixed ")]: new_task = FixedTask(desc, int(hours), due_dt) #fake the starttime and endtime else: if due_dt <= datetime.date.today(): print "[!] Task `{}` due on or before today.".format(desc) continue new_task = Task(desc, int(hours), due_dt) try: mgr.add(new_task) except TaskAlreadyExists: print "found duplicate task {}".format(desc) exit() print "[+] {} tasks processed. Attempting to generate schedule.".format(mgr.num_tasks()) prompted = False while MAX_HOURS < 24: try: #we often expect this to fail so using an exception is a little worse than returning None agenda = mgr.calc_agenda(MAX_HOURS, max_days=MAXIMIZE_DAYS,\ work_days=WORK_DAYS, work_today=WORK_TODAY, user_specified_days=USER_SPEC_DAYS) break except NotEnoughTime: #it's a little spamming to print this every time. do it better later if not prompted: print "[!] Not enough time available to finish your work in {} hours, increasing as necessary.".format(MAX_HOURS) prompted = True MAX_HOURS += 1 if MAX_HOURS >= 24: