File imports can be scheduled to be executed regularly using for example Windows Task Scheduler. Follow these steps:
pythonw.exe
located in the virtual environment you want to use (i.e. <path to venv>\scripts\pythonw.exe
Test your script from the command prompt before scheduling it to make sure it works properly.
When running with pythonw.exe
, no console window will be displayed so you'll not get much feedback as to what's going on. This is probably what you want in production scenarios where you can use logs to report errors.
While you're setting up the scheduled task you can use python.exe
instead. This displays a console window where you can see print()
statements and even debug your scripts from within the task scheduler.
Unless you point out a specific starting or working folder for the scheduled task it will be C:\
.