How To Schedule A Python Script
Whenever we think about automating something, there are many questions which come to our mind. Like,
- How will we schedule it?
- How many times we want to execute it?
- Is it possible to automate this scheduling part?
Well, in this article I’m going to walk you through all those various steps which are required to schedule a Python script on Windows.
Step 1: Prepare The Python script
Automation begins with the piece of code which will automate something. So, the first step here is to get ready with a Python script which must be in working condition.
There is no constraint on how big or small a script has to be, but we need to make sure that the script is doing what it is intended to do.
Step 2: Create An Executable
Once the script is verified, we need to create an executable or EXE file as this executable file we are going to schedule in our next step.
In order to create an executable in Python, we need to install a package named pyinstaller using pip:
pip install pyinstaller
Once the package is installed successfully, we can go ahead and run the command to create an executable as shown below:
pyinstaller — onefile <Your_py_FileName>