I have a very simple python script (to send an email) which works perfectly when I run it in the cmd window, or in python, or if I directly start a a .bat file pointing to it.
However, when I try to get the task scheduler to run it, nothing happens. The task scheduler says that it runs and completes successfully, the log file is blank, but no email is sent.
I'm aware there are a lot of other questions relating to this problem, and I've read through them and tried the solutions, but nothing seems to work. I am new to python (and to scheduling tasks!), so I may be implementing the solutions incorrectly.
Here is what I've tried...
Creating a batch file with the script in it in various ways:
python C:\Users\me\Documents\etc\script.py >C:\Users\me\Documents\etc\log.txt python "C:\Users\me\Documents\etc\script.py >C:\Users\me\Documents\etc\log.txt" C:\Users\me\AppData\Local\Programs\Python\Python35-32\python.exe C:\Users\me\Documents\etc\script.py "C:\Users\me\AppData\Local\Programs\Python\Python35-32\python.exe" "C:\Users\me\Documents\etc\script.py" C:\Users\me\Documents\etc\script.py
All of these work fine when double clicking on the file - but none run in task manager. (Although they say they have completed successfully). In task manager I just put the link to the .bat file in the "Program/script" box.
Doing the above but with the full path to the cmd.exe in the program/script, and the .bat file as an argument. I've also tried putting the location of the bat file in the "Start in (optional):"
Trying to run the .py file directly via the task scheduler, putting it in the "Program/script:" box
Trying to run the .py file directly via the task scheduler, putting the full path to the python.exe (see above) in the "Program/script", and the sript.py in the "Add arguments". I've also tried this with path to the location of the script in "Start in".
Trying to run the .py file via the cmd - so putting the full path to the cmd.exe in "Program/script" and the script.py file (full path) in the "Arguments".
Some of the ones where I try to run the script.py directly just say "running" in the Task Scheduler forever, but I didn't note down which these were.
I'm running Windows 7 (64bit), and have got Python 3.5.1 (32bit). I've got local admin rights.
Other scheduled tasks I have created (not involving a python script) work fine, but this has stumped me. Please help!