
Scheduling Jobs on Windows is easier than on Mac thanks to the task scheduler. After this, your terminal should look like the picture below. To do so, open the terminal and run crontab -e. To schedule jobs on macOS, we’re going to use crontab. Note: If you see an error after running the standalone executable like this “ModuleFoundNotError: Not module named ‘ name_of_module’” you’ll have to repeat step 1 again, but now write the following pyinstaller -onefile example.py -hidden-import name_of_module Step 2: Schedule a Job with crontab Inside the folder, you’ll find the standalone executable! Right-click on it, click “open with”, and then “terminal” to test whether everything works fine.

Once you‘re in the path where your script is located, write the following pyinstaller -onefile example.py in the terminal to make the script executable.Īfter this, you’ll see a message that says “completed successfully.” Then in the directory where your script is located, a folder named “dist” should have been created.Inside the terminal, go to the directory where your script is located (use cd to navigate in the directories).Open the terminal and run pip install pyinstaller.To install PyInstaller and make your python script executable do the following. Then it creates copies of all the files and puts them in a single executable file. PyInstaller reads a Python script and finds the libraries the script needs to be executed.

In this case, I will use the “PyInstaller” library because of its simplicity. To schedule a job on macOS, we need first to make our Python file executable (.exe). Step 1: Make Your Python File Executable with PyInstaller

You can use any script you have to follow along.

The Python script we’re going to automate it’s called example.py. In this article, I’ll show you how to do this on Mac and Windows using the crontab and the task scheduler. Instead, you could automate those scripts by scheduling jobs that run your Python scripts at specific times. Running a Python script could be as easy as opening your IDE or text editor and clicking the run button however, if the script has to be executed daily or weekly, you don’t want to waste time repeating these steps over and over again.
