As you can complete cron jobs, a good solution would be to split your script into two parts, one to request when the script will be executed, and the other the actual script.
Your first script will create a cron job to schedule script execution, for which you can use the python-crontab package:
pip install python-crontab
To create a cron job:
from datetime import datetime from crontab import CronTab run_date_input = raw_input("Please enter a date (eg 2017-11-28): ") run_time_input = raw_input("What time do you want to start the script (eg 14:30:12)? ") run_date = datetime.strptime(run_date_input, "%y-%m-%d") run_time = datetime.strptime(run_time_input, "%H:%M:%S")
If you use windows, you need to install cron for Windows using something like cygwin or the new Linux subsystem for Windows 10.
source share