June 2017
Beginner to intermediate
274 pages
6h 49m
English
To manage that, we're going to need the last of our six interesting things in the subprocess package-the PIPE constant. The PIPE constant is used in conjunction with the stdin, stdout, or stderr keyword parameters of the Popen constructor:
p = Popen(['python3', 'echo.py'], stdin = PIPE, stout = PIPE, bufsize = 0)
These parameters represent the other program's textual input, output, and error reporting. Any of them that we set to PIPE are redirected to our program. In the preceding example, we're redirecting the program's inputs and output to ourselves, which gives us a bi-directional data channel with the other programs.
Now you see, we are interacting programmatically with the code on screen that was at the beginning ...
Read now
Unlock full access