Desired Result
Hi, I am using a machine running windows 10 to automate a scraper that is written in python and uses selenium (with chrome driver). I want this to run every day at 3:00 am.
Best Attempt
It seems the best way to do this is to write a batch file test_bat.bat
that runs the python script in its virtual environment. Here are the contents of test_bat.bat
:
C:\Users\data_miner\PycharmProjects\SeleniumScraper\venv\Scripts\activate.bat && python C:\Users\data_miner\PycharmProjects\SeleniumScraper\ScraperWindows.py
I learned how to do this here. This works excellently when run by clicking on the .bat file icon directly.
Problem
However, when fired (whether by the trigger or manually) there is no effect other than a change of status from 'ready' to 'running' and the pictured rows in history:
Details
The Action that I created has the following values (instructions were followed from here):
Action: Start a program, Program/script: C:\data_miner\Desktop\test_batch.bat
("C:\data_miner\Desktop\test_batch.bat" is the path to the batch file)
A similar problem that I have read the solution for:
HERE: the solution to this problem was setting the "working directory" to the location of the bat file. I first assumed that by working directory, they meant the 'Start in (optional)' field in 'Actions', this didn't work. Secondly I tried adding a cd command to the first line of the batch file: cd C:\data_miner\Desktop
this also made no difference.
Comments
I can provide the python scripts if appropriate but chose not to here as the script works fine when run from the bat. The problem is in the transition from opening the bat to getting task scheduler to open it.
How do I get this thing to work?