I'm trying to run a cron job for a simple python script that will output the current time and date into a txt file.
The writedate script works fine but the cron job can't pickup the file writeDate.py no matter what path I specify.
I've tried running the file directly from the path that I put into the cron job and it works absolutely fine but it just can't find the file for some reason when I try to locate it in the cronjob script.
This is the scheduleCron.py code:
from crontab import CronTab
my_cron = CronTab(user='user')
filepath = 'C:\\Users\\user\\Downloads\\Python-Projects\\writeDate.py'
job = my_cron.new(command='python '+filepath)
job.minute.every(1)
my_cron.write()
It gives me the error [WinError 2] The system cannot find the file specified
For clarity i'm using this example - https://code.tutsplus.com/tutorials/managing-cron-jobs-using-python--cms-28231
I've also tried, in Python, printing that path and it loads the file correctly but for some reason the cron script doesn't detect it.