I am getting the following error while running scheduler library. I did go through similar question and answers but somehow not able to identify the root cuase the error. Could some help where I am going wrong?
TypeError: the first argument must be callable
import schedule
import time
class Scheduler():
def trigger_testsuite(self):
print("I am working as expected.")
def scheule_a_job(self, type="Secs", interval=5):
if (type == "Mins"):
schedule.every(interval).minutes.do(self.trigger_testsuite())
if (type == "Secs"):
schedule.every(interval).seconds.do(self.trigger_testsuite())
if (interval == "Hrs"):
schedule.every().hour.do(self.trigger_testsuite())
if (interval == "Daily"):
schedule.every().day.at("10:00").do(self.trigger_testsuite())
while True:
schedule.run_pending()
time.sleep(1)
if __name__ == "__main__":
run = Scheduler()
run.scheule_a_job()
TraceBack:-
I am working as expected.
Traceback (most recent call last):
File "foo/Scheduler.py", line 31, in <module>
run.scheule_a_job()
File "foo/Scheduler.py", line 16, in scheule_a_job
schedule.every(interval).seconds.do(self.trigger_testsuite())
File "foo\Python\Python38-32\lib\site-packages\schedule\__init__.py", line 440, in do
self.job_func = functools.partial(job_func, *args, **kwargs)
TypeError: the first argument must be callable
Process finished with exit code 1