I have a python 3 script that relies on (among other things) selenium
, bs4
, smtplib
, and xlsxwriter
. The script scrapes a website, saves a large chunk of data to an Excel file, and then emails me smaller chunks of data that are of particular interest. I have run the script numerous times and it works fine (i.e., it writes the excel file and emails me).
Recently, I used Task Scheduler on Windows 10 to set this script to run every 24 hours. The program apparently runs (and is recorded as successful by Task Scheduler). The problem is the when Task Scheduler executes the program I only receive the email with smaller chunks of data. The Excel file is not written.
Under Task Scheduler, I put the following in the Program/Script box: C:\path\to\python\python.exe
. Under Arguments, I put: C:\path\to\script.py
.
Note, per a previous SO question, I tried putting cmd
under Program/Script and then C:\path\to\python\python.exe C:\path\to\script.py
as the arguments. The program didn't run at all with the latter cmd
setup.
Not sure if relevant, but I added c:\path\to\python\python36-32\
and c:\path\to\scriptfolder\
to my system variables path. I put #!python3
at the top of my scripts. Thanks.