
These I/O channels are called the standard input, standard output and standard error respectively and can also be refered to by their corresponding file descriptors which are the numbers 0, 1 and 2 respectively. In UNIX and Linux, there are three I/O channels known as streams which connect a computer program with its environment such as a text terminal (eg gnome-terminal' running Bash) or another computer program (eg a Python program using the ``subprocess` module).


In this post I'm going to look at how you can interact with other command line programs using Python's subprocess module. In my last post I wrote about how to build a command line interface with sub-commands in Python. Accessing Return Values, poll() and wait().Reading and Writing to the Same Process.Reading from Standard Output and Standard Error.Redirecting Standard Input and Standard Output to and from the Standard File Handles.Redirecting Standard input and Standard Output to Files.What Happens When you Execute a Command?.
