scheduler

While True python statement to execute code biweekly on a specific date WITHOUT cron?

While True python statement to execute code biweekly on a specific date WITHOUT cron? Question: How can I execute code, like a simple print("whatever"), biweekly, at a specific time. For example, every other Monday print("test") at 1 PM EST. This has to be without cron. I realize there are numerous solutions using crontab. Not an …

Total answers: 1

Scheduling an async function in Discord.py

Scheduling an async function in Discord.py Question: I’ve been trying to schedule a discord.py function to be run every day at midnight. async def send(): updays[0] += 1 await client.get_channel(XXXXXXXXXXXXXXXXX).send(f"It has been {updays[0]} days.") I first tried it with schedule schedule.every().day.at(’00:00′).do(send) And then learned it can’t handle async functions. I then ran into an SO …

Total answers: 1

How to get status of job using Scheduler?

How to get status of job using Scheduler? Question: I have a scheduled job running on Scheduler library, and I would like to get its status ("Success", "Failed") from python but I can’t find documentation on how to get the status. Let’s take as an example the following code to use the scheduler : import …

Total answers: 1

Apscheduler run job every weekday on specific time range

Apscheduler run job every weekday on specific time range Question: I have a current apscheduler that runs the job mon-fri and an interval of ~4 mins all day long. Is it possible to run the job for a specific time range? Lets say from 9:00 am to 5:00 pm in this case? My expression looks …

Total answers: 2

python schedule jobs with different timezones

python schedule jobs with different timezones Question: I want to schedule a python function to run everyday at a certain time for a list of customers with different timezones. This is basically what I want to do: import schedule import time def job(text): print(“Hello ” + text) def add_job(user_tz, time, text): schedule.every().day.at(time).do(job(text)) # the above …

Total answers: 2

Python script to do something at the same time every day

Python script to do something at the same time every day Question: I have a long running python script that I want to do someting at 01:00 every morning. I have been looking at the sched module and at the Timer object but I can’t see how to use these to achieve this. Asked By: …

Total answers: 4

Start a Function at Given Time

Start a Function at Given Time Question: How can I run a function in Python, at a given time? For example: run_it_at(func, ‘2012-07-17 15:50:00′) and it will run the function func at 2012-07-17 15:50:00. I tried the sched.scheduler, but it didn’t start my function. import time as time_module scheduler = sched.scheduler(time_module.time, time_module.sleep) t = time_module.strptime(‘2012-07-17 …

Total answers: 9

How can I run an external command asynchronously from Python?

How can I run an external command asynchronously from Python? Question: I need to run a shell command asynchronously from a Python script. By this I mean that I want my Python script to continue running while the external command goes off and does whatever it needs to do. I read this post: Calling an …

Total answers: 10