I'm working with the schedule package built by Dan Bader and I'm not sure how to pass a counter into the package.
Here is the basic example of how this is used:
def job(message="stuff"):
print("I'm working on:", str(message))
schedule.every(10).seconds.do(job)
while True:
schedule.run_pending()
time.sleep(1)
So this prints I'm working on: stuff
every 10 seconds which is great but what its missing for my application is a counter. I'd like to count every time a job is run and pass that into my function but I haven't been able to figure that out.
This was my latest attempt:
def job(count = 0):
print(count)
count = 0
schedule.every(10).seconds.do(job, count)
while True:
schedule.run_pending()
time.sleep(1)
count += 1
I thought that having count as a parameter and looping it within the while loop would work but it did not.
At the end of the day, I need a platform that will allow me to constantly run a function at some interval and keep track of how many times the job has run.
Any help would be much appreciated