yjmd2222 / automatic-attendance

Apache License 2.0
3 stars 0 forks source link

TypeError: 'OrTrigger' object is not iterable #51

Closed yjmd2222 closed 1 year ago

yjmd2222 commented 1 year ago
Job "decorator_start_end.<locals>.inner_decorator.<locals>.wrapper (trigger: or[cron[year='2023', month='7', day='10', hour='11', minute='10'], cron[year='2023', month='7', day='10', hour='11', minute
='15'], cron[year='2023', month='7', day='10', hour='11', minute='20'], cron[year='2023', month='7', day='10', hour='11', minute='25'], cron[year='2023', month='7', day='10', hour='11', minute='30'], 
cron[year='2023', month='7', day='10', hour='13', minute='1'], cron[year='2023', month='7', day='10', hour='13', minute='6'], cron[year='2023', month='7', day='10', hour='13', minute='11'], cron[year=
'2023', month='7', day='10', hour='13', minute='16'], cron[year='2023', month='7', day='10', hour='13', minute='21'], cron[year='2023', month='7', day='10', hour='15', minute='10'], cron[year='2023', 
month='7', day='10', hour='15', minute='15'], cron[year='2023', month='7', day='10', hour='15', minute='20'], cron[year='2023', month='7', day='10', hour='15', minute='25'], cron[year='2023', month='7
', day='10', hour='15', minute='30']], next run at: 2023-07-10 11:25:00 KST)" raised an exception
Traceback (most recent call last):
  File "C:\Users\jinmo\anaconda3\envs\fakezoom\Lib\site-packages\apscheduler\executors\base.py", line 125, in run_job
    retval = job.func(*job.args, **job.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jinmo\Documents\GitHub\fake-attendance\fake_attendance\helper.py", line 21, in wrapper
    func(*args, **kwargs)
  File "C:\Users\jinmo\Documents\GitHub\fake-attendance\fake_attendance\fake_check_in.py", line 269, in run
    self.drop_runs_until(self.print_name, until)
  File "C:\Users\jinmo\Documents\GitHub\fake-attendance\fake_attendance\scheduler.py", line 136, in drop_runs_until
    self.reschedule(job_id, rescheduled_trigger, is_remove_job)
  File "C:\Users\jinmo\Documents\GitHub\fake-attendance\fake_attendance\scheduler.py", line 148, in reschedule
    print(rescheduled_trigger)
  File "C:\Users\jinmo\anaconda3\envs\fakezoom\Lib\site-packages\apscheduler\triggers\combining.py", line 95, in __str__
    return 'or[{}]'.format(', '.join(str(trigger) for trigger in self.triggers))
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'OrTrigger' object is not iterable

Probably this: https://github.com/yjmd2222/fake-attendance/blob/23eea0acf88e85631609ff5f6f875d62375378af/fake_attendance/scheduler.py#L131 self.build_trigger() returns OrTrigger, and OrTrigger only accepts an iterable: https://github.com/yjmd2222/fake-attendance/blob/23eea0acf88e85631609ff5f6f875d62375378af/fake_attendance/scheduler.py#L76-L85 So change it to

            rescheduled_trigger = self.build_trigger(new_time_sets)

maybe.

Wondering why it wasn't throwing errors when I was testing last weekend, and I'm looking at job the schedule of which still contains the past triggers. Is it showing the job that is not yet rescheduled? Most likely.