Setting up a shell script or batch file to launch the program
In this section, we're going to wrap up this chapter's example program by making it simple to launch. We can run our program using python -m
as long as it's installed in the system PYTHONPATH
or we've activated the virtual environment containing it, as shown here:

Creating launches for our program
Once the program is solid, we really just want to be able to type its name or double-click on it and have it run. One convenient way to do that is to use a shell script or a batch file:
- On Unix-style operating systems including macOS, a shell script is a text file that starts with
#bang/bin/sh
and has been marked as executable - On Windows, a batch file is a file whose name ends in
.bat
Both shell scripts and batch files are text files containing a sequence of command-line commands, one on each line. When we type the name of the script or batch file, those commands are executed one after the other, as if we type them all into the command line...